diff options
author | stuconnolly <stuart02@gmail.com> | 2011-10-16 11:58:12 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-10-16 11:58:12 +0000 |
commit | 952daabb67e002e957429142f11333fa2eb2a8fb (patch) | |
tree | f1b9cb35f1b99f2c30c956796d5652b9eaccbfdf /Source/SPQueryController.m | |
parent | 426ede7d486847f21d8565d6d9e47f4637ec2dd1 (diff) | |
download | sequelpro-952daabb67e002e957429142f11333fa2eb2a8fb.tar.gz sequelpro-952daabb67e002e957429142f11333fa2eb2a8fb.tar.bz2 sequelpro-952daabb67e002e957429142f11333fa2eb2a8fb.zip |
When building a string of all console messages, use a copy of the visible message set ensure it's not modified while being enumerated. Fixes exception http://spbug.com/l/2743
Diffstat (limited to 'Source/SPQueryController.m')
-rw-r--r-- | Source/SPQueryController.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 46c9da3d..a3c46160 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -518,6 +518,8 @@ static SPQueryController *sharedQueryController = nil; NSMutableString *consoleString = [NSMutableString string]; #ifndef SP_REFACTOR + NSArray *messageCopy = [messagesVisibleSet copy]; + for (SPConsoleMessage *message in messagesVisibleSet) { // As we are going to save the messages as an SQL file we need to comment @@ -525,18 +527,22 @@ static SPQueryController *sharedQueryController = nil; if (timeStamps || connections) [consoleString appendString:@"/* "]; // If the timestamp column is not hidden we need to include them in the copy - if (timeStamps) + if (timeStamps) { [consoleString appendFormat:@"%@ ", [dateFormatter stringFromDate:[message messageDate]]]; + } // If the connection column is not hidden we need to include them in the copy - if (connections) + if (connections) { [consoleString appendFormat:@"%@ ", [message messageConnection]]; + } // Close the comment if (timeStamps || connections) [consoleString appendString:@"*/ "]; [consoleString appendFormat:@"%@\n", [message message]]; } + + [messageCopy release]; #endif return consoleString; |