aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionDelegate.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-03-27 15:01:59 +0000
committerrowanbeentje <rowan@beent.je>2010-03-27 15:01:59 +0000
commit0559e08ff40bc2496c6af22beb4df99cf112e13b (patch)
treed665a5140902bc5dd72da608cf38f8c397fdad21 /Source/SPConnectionDelegate.m
parentcf8f377e47e14498c9f0d3628752b1ea60437cab (diff)
downloadsequelpro-0559e08ff40bc2496c6af22beb4df99cf112e13b.tar.gz
sequelpro-0559e08ff40bc2496c6af22beb4df99cf112e13b.tar.bz2
sequelpro-0559e08ff40bc2496c6af22beb4df99cf112e13b.zip
- When switching tables, correctly catch disconnections and suppress error dialogs and related crashes
- Move connection error sheet close method to the connection delegate - Tweak the information_schema db schema building query to be much faster on busy servers by amending the VIEW part - Set the connection lock to nil after releasing, coping with connection unlocks deferred on the main thread until after dealloc
Diffstat (limited to 'Source/SPConnectionDelegate.m')
-rw-r--r--Source/SPConnectionDelegate.m17
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m
index 6e755d1a..56a254fa 100644
--- a/Source/SPConnectionDelegate.m
+++ b/Source/SPConnectionDelegate.m
@@ -110,22 +110,31 @@
*/
- (MCPConnectionCheck)connectionLost:(id)connection
{
+
+ // Display the connection error dialog and wait for the return code
[NSApp beginSheet:connectionErrorDialog modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
+ NSInteger connectionErrorCode = [NSApp runModalForWindow:connectionErrorDialog];
- NSInteger connectionErrorCode = [NSApp runModalForWindow:connectionErrorDialog];
-
[NSApp endSheet:connectionErrorDialog];
[connectionErrorDialog orderOut:nil];
-
+
// If 'disconnect' was selected, trigger a window close.
if (connectionErrorCode == MCPConnectionCheckDisconnect) {
[self performSelectorOnMainThread:@selector(closeDocumentWindowAndDisconnect) withObject:nil waitUntilDone:YES];
}
-
+
return connectionErrorCode;
}
/**
+ * Invoked when user dismisses the error sheet displayed as a result of the current connection being lost.
+ */
+- (IBAction)closeErrorConnectionSheet:(id)sender
+{
+ [NSApp stopModalWithCode:[sender tag]];
+}
+
+/**
* Close the connection - should be performed on the main thread.
* First hides the window to give code a little bit of time to clean
* everything up before it's all deallocated as a result of the close.