Permalink
Browse files

Make sure we have a read-path before we start to receive messages

  • Loading branch information...
1 parent 9ba1116 commit 59e94acc18c805d11c48cef6b3d4715b7040338f Jonathan del Strother committed Sep 10, 2009
Showing with 9 additions and 8 deletions.
  1. +9 −8 BBOSCPluginReceiver.m
View
@@ -84,7 +84,8 @@ - (id) init
[[BBOSCManager sharedManager] addDelegate:self];
self.oscParameters = [NSArray array];
messages = [[NSMutableArray alloc] init];
- messageLock = [[NSLock alloc] init];
+ messageLock = [[NSLock alloc] init];
+ listeningPath = @"";
}
return self;
@@ -182,6 +183,13 @@ Return NO in case of failure during the execution (this will prevent rendering o
CGLContextObj cgl_ctx = [context CGLContextObj];
*/
+ if ([self didValueForInputKeyChange:@"inputReceivingPath"]) {
+ [messageLock lock];
+ self.listeningPath = self.inputReceivingPath;
+ [messages removeAllObjects];
+ [messageLock unlock];
+ }
+
if ([self didValueForInputKeyChange:@"inputReceivingPort"]) {
if (self.oscPort)
[[BBOSCManager sharedManager] removeInput:self.oscPort];
@@ -190,13 +198,6 @@ Return NO in case of failure during the execution (this will prevent rendering o
NSLog(@"Failed to created input port");
}
- if ([self didValueForInputKeyChange:@"inputReceivingPath"]) {
- [messageLock lock];
- self.listeningPath = self.inputReceivingPath;
- [messages removeAllObjects];
- [messageLock unlock];
- }
-
[messageLock lock];
if ([messages count]==0) {
self.outputMessageReceived = NO;

0 comments on commit 59e94ac

Please sign in to comment.