From dc45c654aab99cbccecda192396dc8baefd5690e Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 14 Oct 2012 16:09:45 +0000 Subject: - In the SPMySQL.framework, separate framework-triggered connections and disconnections from external actions, and use that separation to perform safer disconnects - When closing a database document, add a new notification, and use that to resolve retain cycles affecting connection processes - Improve connection controller disconnection when the document is closed, fixing crashes, by building on those two features (addresses Issue #1396) - Use some of the new functionality to improve SSH and MySQL connection cancellation, making both cancelable in the interface and making both respond much more quickly --- Source/SPDatabaseDocument.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'Source/SPDatabaseDocument.m') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 0bfbb16f..fa46db2d 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4065,8 +4065,11 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; [mySQLConnection setDelegate:nil]; - if (_isConnected) [self closeConnection]; - else [connectionController cancelConnection]; + if (_isConnected) { + [self closeConnection]; + } else { + [connectionController cancelConnection:self]; + } #ifndef SP_REFACTOR if ([[[SPQueryController sharedQueryController] window] isVisible]) [self toggleConsole:self]; [createTableSyntaxWindow orderOut:nil]; @@ -5737,7 +5740,9 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; #endif - [databaseStructureRetrieval destroy]; + // Tell listeners that this database document is being closed - fixes retain cycles and allows cleanup + [[NSNotificationCenter defaultCenter] postNotificationName:SPDocumentWillCloseNotification object:self]; + [databaseStructureRetrieval release]; [allDatabases release]; -- cgit v1.2.3