mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-06-17 05:39:17 +08:00
Dealloc first time RCTNetInfo reachability callback
Summary: @public We're seeing a crasher where `self` on line 54 isn't an `RCTNetInfo`. The timing looks related to D9798488, so my theory is that this class is being deallocated before it resolves, and thus causes a crash. Reviewed By: PeteTheHeat Differential Revision: D10127341 fbshipit-source-id: 94eaba7def6b118092adcf6b4cce841ccc7d0b59
This commit is contained in:
committed by
Facebook Github Bot
parent
408207b356
commit
e7e63fd409
@@ -105,6 +105,14 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (_firstTimeReachability) {
|
||||
SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
|
||||
CFRelease(self->_firstTimeReachability);
|
||||
}
|
||||
}
|
||||
|
||||
- (SCNetworkReachabilityRef)getReachabilityRef
|
||||
{
|
||||
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, _host.UTF8String ?: "apple.com");
|
||||
|
||||
Reference in New Issue
Block a user