aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2013-08-26 00:26:58 +0000
committerrowanbeentje <rowan@beent.je>2013-08-26 00:26:58 +0000
commita401c044675a24d9ee0508b6014cc691349485e9 (patch)
tree84f7407e26a34b27e1747f0c3847dffb326984fa /Source
parent0e522d9bd52a2b1be6295ee5e196ffece4b9ae6c (diff)
downloadsequelpro-a401c044675a24d9ee0508b6014cc691349485e9.tar.gz
sequelpro-a401c044675a24d9ee0508b6014cc691349485e9.tar.bz2
sequelpro-a401c044675a24d9ee0508b6014cc691349485e9.zip
- Improve thread safety within the console window, triggering draw and view updates only on the main window
- Ensure the console window is first loaded on the main thread, fixing warnings from CoreAnimation ("CoreAnimation: warning, deleted thread with uncommitted CATransaction") on startup when a background thread calls [window isVisible] and triggers a lazy awakeFromNib of the window
Diffstat (limited to 'Source')
-rw-r--r--Source/SPQueryController.m14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index f4586cf3..929de617 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -116,6 +116,10 @@ static SPQueryController *sharedQueryController = nil;
NSError *error = [self loadCompletionLists];
+ // Trigger a load of the nib to prevent problems if it's lazy-loaded on first console message
+ // on a bckground thread
+ [[[self onMainThread] window] displayIfNeeded];
+
if (error) {
NSLog(@"Error loading completion tokens data: %@", [error localizedDescription]);
}
@@ -595,17 +599,15 @@ static SPQueryController *sharedQueryController = nil;
&& [self _messageMatchesCurrentFilters:[consoleMessage message]])
{
[messagesFilteredSet addObject:[messagesFullSet lastObject]];
- [saveConsoleButton setEnabled:YES];
- [clearConsoleButton setEnabled:YES];
+ [[saveConsoleButton onMainThread] setEnabled:YES];
+ [[clearConsoleButton onMainThread] setEnabled:YES];
}
// Reload the table and scroll to the new message if it's visible (for speed)
if (allowConsoleUpdate && [[self window] isVisible]) {
- [consoleTableView noteNumberOfRowsChanged];
- [consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)];
- [consoleTableView reloadData];
+ [[self onMainThread] updateEntries];
}
-
+
pthread_mutex_unlock(&consoleLock);
#endif
}