From 9997d982ca4fcbacb04b41c7f7e2aa7dd44db312 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 24 Jan 2010 21:02:18 +0000 Subject: Improve Disconnection on connection loss: - Set error strings on MCPConnection on user disconnect to allow existing error chcking to catch the state - Improve close behaviour from threads - Improve window close behaviour and appearance - Add new checks for disconnection in one or two crash-prone locations This addresses Issue #531, one of Issue #532, one of Issue #539, and probable reported crashes on Issue #541. --- Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Frameworks') diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index cda82647..7a3c9c8c 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -341,6 +341,7 @@ static BOOL sTruncateLongFieldInLogs = YES; mConnected = YES; connectionStartTime = mach_absolute_time(); mEncoding = [MCPConnection encodingForMySQLEncoding:mysql_character_set_name(mConnection)]; + [self setLastErrorMessage:nil]; connectionThreadId = mConnection->thread_id; [self timeZone]; // Getting the timezone used by the server. @@ -536,8 +537,12 @@ static BOOL sTruncateLongFieldInLogs = YES; return [self checkConnection]; - // 'Disconnect' has been selected. Close the parent window, which will handle disconnections, and return false. + // 'Disconnect' has been selected. The parent window should already have + // triggered UI-specific actions, and may have disconnected already; if + // not, disconnect, and clean up. case MCPConnectionCheckDisconnect: + if (mConnected) [self disconnect]; + [self setLastErrorMessage:NSLocalizedString(@"User triggered disconnection", @"User triggered disconnection")]; return NO; // 'Retry' has been selected - return a recursive call. -- cgit v1.2.3