aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionDelegate.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPConnectionDelegate.m')
-rw-r--r--Source/SPConnectionDelegate.m24
1 files changed, 15 insertions, 9 deletions
diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m
index 56a254fa..c69c3150 100644
--- a/Source/SPConnectionDelegate.m
+++ b/Source/SPConnectionDelegate.m
@@ -110,18 +110,24 @@
*/
- (MCPConnectionCheck)connectionLost:(id)connection
{
+ NSInteger connectionErrorCode = MCPConnectionCheckDisconnect;
- // 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];
+ // Only display the reconnect dialog if the window is visible
+ if ([tableWindow isVisible]) {
- [NSApp endSheet:connectionErrorDialog];
- [connectionErrorDialog orderOut:nil];
+ // 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];
+ }
+ }
- // If 'disconnect' was selected, trigger a window close.
- if (connectionErrorCode == MCPConnectionCheckDisconnect) {
- [self performSelectorOnMainThread:@selector(closeDocumentWindowAndDisconnect) withObject:nil waitUntilDone:YES];
- }
return connectionErrorCode;
}