aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-04-27 09:26:13 +0000
committerstuconnolly <stuart02@gmail.com>2010-04-27 09:26:13 +0000
commitf22d42877a8ea4ea5c67fc8a95a62cd00d2d74e2 (patch)
tree71e66ddc37d1b23e685ea8fe6161e12f9e683d49
parent5af57456d3669d048c16831bd3a5afdb7ca9b2e2 (diff)
downloadsequelpro-f22d42877a8ea4ea5c67fc8a95a62cd00d2d74e2.tar.gz
sequelpro-f22d42877a8ea4ea5c67fc8a95a62cd00d2d74e2.tar.bz2
sequelpro-f22d42877a8ea4ea5c67fc8a95a62cd00d2d74e2.zip
Add extra connection checking at multiple stages of getting the server's process list. Fixes http://spbug.com/l/152.
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m12
-rw-r--r--Source/SPProcessListController.m25
2 files changed, 21 insertions, 16 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 5fd3a9a2..27ae11ae 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -2412,12 +2412,14 @@ void performThreadedKeepAlive(void *ptr)
[self lockConnection];
- if (theResPtr = mysql_list_processes(mConnection)) {
- result = [[MCPResult alloc] initWithResPtr:theResPtr encoding:mEncoding timeZone:mTimeZone];
+ if (mConnected && (mConnection != NULL)) {
+ if (theResPtr = mysql_list_processes(mConnection)) {
+ result = [[MCPResult alloc] initWithResPtr:theResPtr encoding:mEncoding timeZone:mTimeZone];
+ }
+ else {
+ result = [[MCPResult alloc] init];
+ }
}
- else {
- result = [[MCPResult alloc] init];
- }
[self unlockConnection];
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index 92744276..07c67247 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -623,17 +623,20 @@
NSUInteger i = 0;
// Get processes
- MCPResult *processList = [connection listProcesses];
-
- [processList setReturnDataAsStrings:YES];
-
- if ([processList numOfRows]) [processList dataSeek:0];
-
- [processes removeAllObjects];
-
- for (i = 0; i < [processList numOfRows]; i++)
- {
- [processes addObject:[processList fetchRowAsDictionary]];
+ if ([connection isConnected]) {
+
+ MCPResult *processList = [connection listProcesses];
+
+ [processList setReturnDataAsStrings:YES];
+
+ if ([processList numOfRows]) [processList dataSeek:0];
+
+ [processes removeAllObjects];
+
+ for (i = 0; i < [processList numOfRows]; i++)
+ {
+ [processes addObject:[processList fetchRowAsDictionary]];
+ }
}
// Update the UI on the main thread