aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionDelegate.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-04-23 13:49:12 +0000
committerstuconnolly <stuart02@gmail.com>2010-04-23 13:49:12 +0000
commitb0195c5305a4fc3db4ffaa113ce4d246bd4dec66 (patch)
treef8228614a23e69380fa31453cd93f8396a17da48 /Source/SPConnectionDelegate.m
parent598adc2028c9a250ad68b100f8e9def6c2850b8c (diff)
downloadsequelpro-b0195c5305a4fc3db4ffaa113ce4d246bd4dec66.tar.gz
sequelpro-b0195c5305a4fc3db4ffaa113ce4d246bd4dec66.tar.bz2
sequelpro-b0195c5305a4fc3db4ffaa113ce4d246bd4dec66.zip
Only attempt to check or set the max allowed packet if there is an active connection as well as only displaying dialogs when there is a window visible. Fixes http://spbug.com/l/113.
Diffstat (limited to 'Source/SPConnectionDelegate.m')
-rw-r--r--Source/SPConnectionDelegate.m27
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m
index 56a254fa..ae67697c 100644
--- a/Source/SPConnectionDelegate.m
+++ b/Source/SPConnectionDelegate.m
@@ -110,17 +110,22 @@
*/
- (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];
-
- [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];
+ NSInteger connectionErrorCode = MCPConnectionCheckDisconnect;
+
+ // Only display the reconnect dialog if the window is visible
+ if ([tableWindow isVisible]) {
+
+ // Display the connection error dialog and wait for the return code
+ [NSApp beginSheet:connectionErrorDialog modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
+ 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;