aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseStructure.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-10-14 16:09:45 +0000
committerrowanbeentje <rowan@beent.je>2012-10-14 16:09:45 +0000
commitdc45c654aab99cbccecda192396dc8baefd5690e (patch)
treea1b0a16eb468e191177c3617fc1f3c73c3e4750f /Source/SPDatabaseStructure.m
parent7d14dae0476ee3e3ab7c2fac391c506ac320d5ea (diff)
downloadsequelpro-dc45c654aab99cbccecda192396dc8baefd5690e.tar.gz
sequelpro-dc45c654aab99cbccecda192396dc8baefd5690e.tar.bz2
sequelpro-dc45c654aab99cbccecda192396dc8baefd5690e.zip
- 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
Diffstat (limited to 'Source/SPDatabaseStructure.m')
-rw-r--r--Source/SPDatabaseStructure.m11
1 files changed, 9 insertions, 2 deletions
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);