Permalink
Browse files

Fix a race condition in debug code that could lead to accessing a fre…

…ed object
  • Loading branch information...
dmoagx committed Mar 10, 2017
1 parent 7c56b11 commit cbfadab19e17a4c50e4ddfd5599887cb0597ced5
@@ -81,8 +81,10 @@ - (void)_keepAlive
*/
- (void)_threadedKeepAlive
{
if(keepAliveThread) {
NSLog(@"warning: overwriting existing keepAliveThread: %@, results may be unpredictable!",keepAliveThread);
@synchronized(self) {
if(keepAliveThread) {
NSLog(@"warning: overwriting existing keepAliveThread: %@, results may be unpredictable!",keepAliveThread);
}
}
keepAliveThread = [NSThread currentThread];
@@ -114,7 +116,9 @@ - (void)_threadedKeepAlive
keepAlivePingFailures++;
}
end_cleanup:
keepAliveThread = nil;
@synchronized(self) {
keepAliveThread = nil;
}
}
#pragma mark -

0 comments on commit cbfadab

Please sign in to comment.