aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-04-23 21:38:56 +0000
committerrowanbeentje <rowan@beent.je>2010-04-23 21:38:56 +0000
commitefa3cf18d0d484fb0c5f2d7a1d19a225aa73259d (patch)
tree502a2788947228d90a6b4c473b40e132834bcda7
parent04e2bfabc93ed2014e04928277f931dc01436442 (diff)
downloadsequelpro-efa3cf18d0d484fb0c5f2d7a1d19a225aa73259d.tar.gz
sequelpro-efa3cf18d0d484fb0c5f2d7a1d19a225aa73259d.tar.bz2
sequelpro-efa3cf18d0d484fb0c5f2d7a1d19a225aa73259d.zip
- Ensure that Growl notifications are made from the main thread. This addresses http://spbug.com/643 , and should also fix race condition crashes caused by the timer firing on a closed thread.
-rw-r--r--Source/SPGrowlController.m8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/SPGrowlController.m b/Source/SPGrowlController.m
index 91690546..a92dbdda 100644
--- a/Source/SPGrowlController.m
+++ b/Source/SPGrowlController.m
@@ -25,6 +25,7 @@
#import "SPGrowlController.h"
#import "SPConstants.h"
+#import "SPMainThreadTrampoline.h"
#include <mach/mach_time.h>
@@ -88,6 +89,13 @@ static SPGrowlController *sharedGrowlController = nil;
*/
- (void)notifyWithTitle:(NSString *)title description:(NSString *)description window:(NSWindow *)window notificationName:(NSString *)name
{
+
+ // Ensure that the delayed notification call is made on the main thread
+ if (![NSThread isMainThread]) {
+ [[self onMainThread] notifyWithTitle:title description:description window:window notificationName:name];
+ return;
+ }
+
NSMutableDictionary *notificationDictionary = [NSMutableDictionary dictionary];
[notificationDictionary setObject:title forKey:@"title"];
[notificationDictionary setObject:description forKey:@"description"];