Skip to content

Commit

Permalink
NetInfo: try to solve crash with releasing _firstTimeReachability
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Mehdi Mulani authored and facebook-github-bot committed Nov 12, 2018
1 parent c787866 commit eebc8e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Libraries/Network/RCTNetInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
}
}

// We need RCTReachabilityCallback's and module methods to be called on the same thread so that we can have
// guarantees about when we mess with the reachability callbacks.
- (dispatch_queue_t)methodQueue
{
return dispatch_get_main_queue();
}

#pragma mark - Lifecycle

- (instancetype)initWithHost:(NSString *)host
Expand Down

0 comments on commit eebc8e2

Please sign in to comment.