diff options
author | Max <post@wickenrode.com> | 2017-03-10 04:11:43 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2017-03-10 04:11:43 +0100 |
commit | cbfadab19e17a4c50e4ddfd5599887cb0597ced5 (patch) | |
tree | 11f172f15cf94737584279088157e87a546f57e3 /Frameworks/SPMySQLFramework | |
parent | 7c56b11d8bdead768e86643a4b61e3f293820330 (diff) | |
download | sequelpro-cbfadab19e17a4c50e4ddfd5599887cb0597ced5.tar.gz sequelpro-cbfadab19e17a4c50e4ddfd5599887cb0597ced5.tar.bz2 sequelpro-cbfadab19e17a4c50e4ddfd5599887cb0597ced5.zip |
Fix a race condition in debug code that could lead to accessing a freed object
Diffstat (limited to 'Frameworks/SPMySQLFramework')
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m index 374d0909..d46b5552 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m @@ -81,8 +81,10 @@ */ - (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 @@ keepAlivePingFailures++; } end_cleanup: - keepAliveThread = nil; + @synchronized(self) { + keepAliveThread = nil; + } } #pragma mark - |