aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPQueryController.h2
-rw-r--r--Source/SPQueryController.m11
2 files changed, 13 insertions, 0 deletions
diff --git a/Source/SPQueryController.h b/Source/SPQueryController.h
index 797d5b6b..9c8a9c8f 100644
--- a/Source/SPQueryController.h
+++ b/Source/SPQueryController.h
@@ -57,6 +57,8 @@
NSUserDefaults *prefs;
NSDateFormatter *dateFormatter;
+
+ pthread_mutex_t consoleLock;
}
@property (readwrite, retain) NSFont *consoleFont;
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index eb0e8a1a..ec7e6b70 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -29,6 +29,8 @@
#import "SPConstants.h"
#import "SPCustomQuery.h"
+#import "pthread.h"
+
#define MESSAGE_TRUNCATE_CHARACTER_LENGTH 256
// Table view column identifiers
@@ -96,6 +98,8 @@ static SPQueryController *sharedQueryController = nil;
completionKeywordList = nil;
completionFunctionList = nil;
functionArgumentSnippets = nil;
+
+ pthread_mutex_init(&consoleLock, NULL);
NSError *readError = nil;
NSString *convError = nil;
@@ -824,6 +828,9 @@ static SPQueryController *sharedQueryController = nil;
if(completionKeywordList) [completionKeywordList release];
if(completionFunctionList) [completionFunctionList release];
if(functionArgumentSnippets) [functionArgumentSnippets release];
+
+ pthread_mutex_destroy(&consoleLock);
+
[super dealloc];
}
@@ -981,6 +988,8 @@ static SPQueryController *sharedQueryController = nil;
[consoleMessage setIsError:error];
+ pthread_mutex_lock(&consoleLock);
+
[messagesFullSet addObject:consoleMessage];
// If filtering is active, determine whether to add a reference to the filtered set
@@ -998,6 +1007,8 @@ static SPQueryController *sharedQueryController = nil;
[consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)];
[consoleTableView reloadData];
}
+
+ pthread_mutex_unlock(&consoleLock);
}
@end