Skip to content

Commit eebc8e2

Browse files
Mehdi Mulanifacebook-github-bot
authored andcommitted
NetInfo: try to solve crash with releasing _firstTimeReachability
Summary: @public We're seeing a crash on line 191 when we do `CFRelease(self->_firstTimeReachability);`. My thinking is that there's a race condition between the deallocation coming from calling `getCurrentConnectivity` twice in a row and the callback coming back. Reviewed By: PeteTheHeat Differential Revision: D12982772 fbshipit-source-id: d3d882a074b67a5e547e7f480f561fcaf8d79ec4
1 parent c787866 commit eebc8e2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Libraries/Network/RCTNetInfo.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
6969
}
7070
}
7171

72+
// We need RCTReachabilityCallback's and module methods to be called on the same thread so that we can have
73+
// guarantees about when we mess with the reachability callbacks.
74+
- (dispatch_queue_t)methodQueue
75+
{
76+
return dispatch_get_main_queue();
77+
}
78+
7279
#pragma mark - Lifecycle
7380

7481
- (instancetype)initWithHost:(NSString *)host

0 commit comments

Comments
 (0)