From 9892a96b80073686b0dd1205d4f859b10d32336f Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Mon, 22 Mar 2010 23:07:03 +0000 Subject: - Simplify table source table setup and make thread safe. This should address http://log.sequelpro.com/view/43 , http://log.sequelpro.com/view/46 - Improve keepalive timer interaction - this should address http://log.sequelpro.com/view/74 and http://log.sequelpro.com/view/71 - Further thread safety improvements to Custom Query, Table Document, and the history controller --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Frameworks/MCPKit/MCPFoundationKit') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 1a4786ec..7f5c4365 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -689,6 +689,12 @@ void pingConnectionTask(void *ptr) */ - (void)stopKeepAliveTimer { + // Stop keepalives on the main thread to avoid memory issues + if (![NSThread isMainThread]) { + [self performSelectorOnMainThread:@selector(stopKeepAliveTimer) withObject:nil waitUntilDone:NO]; + return; + } + if (keepAliveThread != NULL) pthread_cancel(keepAliveThread), keepAliveThread = NULL; if (!keepAliveTimer) return; [keepAliveTimer invalidate]; -- cgit v1.2.3