aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework
diff options
context:
space:
mode:
authorMax <dmoagx@users.noreply.github.com>2018-05-19 01:27:49 +0200
committerMax <dmoagx@users.noreply.github.com>2018-05-19 01:27:49 +0200
commit38b9659bc740bf1b5b63d8a84f5633fa593e77b4 (patch)
treec353c0115fd511264a7135664b42cf13e29b8517 /Frameworks/SPMySQLFramework
parentf20ab36802c5b2733fc1cb1900f60df08ea8c1d3 (diff)
downloadsequelpro-38b9659bc740bf1b5b63d8a84f5633fa593e77b4.tar.gz
sequelpro-38b9659bc740bf1b5b63d8a84f5633fa593e77b4.tar.bz2
sequelpro-38b9659bc740bf1b5b63d8a84f5633fa593e77b4.zip
Fix a warning on 10.6 about memory leaks
Diffstat (limited to 'Frameworks/SPMySQLFramework')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m64
1 files changed, 33 insertions, 31 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
index d1de87a1..09988dbe 100644
--- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
+++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Ping & KeepAlive.m
@@ -87,43 +87,45 @@ typedef struct {
*/
- (void)_threadedKeepAlive
{
- @synchronized(self) {
- if(keepAliveThread) {
- NSLog(@"warning: overwriting existing keepAliveThread: %@, results may be unpredictable!",keepAliveThread);
+ @autoreleasepool {
+ @synchronized(self) {
+ if(keepAliveThread) {
+ NSLog(@"warning: overwriting existing keepAliveThread: %@, results may be unpredictable!",keepAliveThread);
+ }
+ keepAliveThread = [NSThread currentThread];
}
- keepAliveThread = [NSThread currentThread];
- }
-
- [keepAliveThread setName:[NSString stringWithFormat:@"SPMySQL connection keepalive monitor thread (id=%p)", self]];
- // If the maximum number of ping failures has been reached, determine whether to reconnect.
- if (keepAliveLastPingBlocked || keepAlivePingFailures >= 3) {
+ [keepAliveThread setName:[NSString stringWithFormat:@"SPMySQL connection keepalive monitor thread (id=%p)", self]];
- // If the connection has been used within the last fifteen minutes,
- // attempt a single reconnection in the background
- if (_elapsedSecondsSinceAbsoluteTime(lastConnectionUsedTime) < 60 * 15) {
- [self _reconnectAfterBackgroundConnectionLoss];
- }
- // Otherwise set the state to connection lost for automatic reconnect on
- // next use.
- else {
- state = SPMySQLConnectionLostInBackground;
- }
+ // If the maximum number of ping failures has been reached, determine whether to reconnect.
+ if (keepAliveLastPingBlocked || keepAlivePingFailures >= 3) {
- // Return as no further ping action required this cycle.
- goto end_cleanup;
- }
+ // If the connection has been used within the last fifteen minutes,
+ // attempt a single reconnection in the background
+ if (_elapsedSecondsSinceAbsoluteTime(lastConnectionUsedTime) < 60 * 15) {
+ [self _reconnectAfterBackgroundConnectionLoss];
+ }
+ // Otherwise set the state to connection lost for automatic reconnect on
+ // next use.
+ else {
+ state = SPMySQLConnectionLostInBackground;
+ }
- // Otherwise, perform a background ping.
- BOOL pingResult = [self _pingConnectionUsingLoopDelay:10000];
- if (pingResult) {
- keepAlivePingFailures = 0;
- } else {
- keepAlivePingFailures++;
- }
+ // Return as no further ping action required this cycle.
+ goto end_cleanup;
+ }
+
+ // Otherwise, perform a background ping.
+ BOOL pingResult = [self _pingConnectionUsingLoopDelay:10000];
+ if (pingResult) {
+ keepAlivePingFailures = 0;
+ } else {
+ keepAlivePingFailures++;
+ }
end_cleanup:
- @synchronized(self) {
- keepAliveThread = nil;
+ @synchronized(self) {
+ keepAliveThread = nil;
+ }
}
}