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/SPDatabaseStructure.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/SPDatabaseStructure.m') diff --git a/Source/SPDatabaseStructure.m b/Source/SPDatabaseStructure.m index 16a5b205..2ceb2728 100644 --- a/Source/SPDatabaseStructure.m +++ b/Source/SPDatabaseStructure.m @@ -81,6 +81,11 @@ structure = [[NSMutableDictionary alloc] initWithCapacity:1]; allKeysofDbStructure = [[NSMutableArray alloc] initWithCapacity:20]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(destroy:) + name:SPDocumentWillCloseNotification + object:theDelegate]; + // Set up the connection, thread management and data locks pthread_mutex_init(&threadManagementLock, NULL); pthread_mutex_init(&dataLock, NULL); @@ -105,7 +110,7 @@ /** * Ensure that processing is completed. */ -- (void)destroy +- (void)destroy:(NSNotification *)notification { delegate = nil; @@ -127,7 +132,9 @@ - (void)dealloc { - [self destroy]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [self destroy:nil]; [structureRetrievalThreads release]; pthread_mutex_destroy(&threadManagementLock); -- cgit v1.2.3