Fixed unguarded critical sections.

CQTexperiment
vspader 2007-10-13 08:14:05 +00:00
parent d5919bc93e
commit fc9069d7c7
1 changed files with 23 additions and 18 deletions

View File

@ -54,20 +54,23 @@
output = [[OutputNode alloc] initWithController:self previous:nil]; output = [[OutputNode alloc] initWithController:self previous:nil];
[output setup]; [output setup];
NSEnumerator *enumerator = [chainQueue objectEnumerator]; @synchronized(chainQueue) {
id anObject; NSEnumerator *enumerator = [chainQueue objectEnumerator];
while (anObject = [enumerator nextObject]) id anObject;
{ while (anObject = [enumerator nextObject])
[anObject setShouldContinue:NO]; {
} [anObject setShouldContinue:NO];
[chainQueue removeAllObjects]; }
[chainQueue removeAllObjects];
if (bufferChain)
{ if (bufferChain)
[bufferChain setShouldContinue:NO]; {
[bufferChain setShouldContinue:NO];
[bufferChain release]; [bufferChain release];
}
} }
bufferChain = [[BufferChain alloc] initWithController:self]; bufferChain = [[BufferChain alloc] initWithController:self];
while (![bufferChain open:url withOutputFormat:[output format]]) while (![bufferChain open:url withOutputFormat:[output format]])
@ -263,13 +266,15 @@
return; return;
} }
bufferChain = [chainQueue objectAtIndex:0]; @synchronized(chainQueue) {
[bufferChain retain]; bufferChain = [chainQueue objectAtIndex:0];
[bufferChain retain];
NSLog(@"New!!! %@ %@", bufferChain, [[bufferChain inputNode] decoder]);
[chainQueue removeObjectAtIndex:0];
}
NSLog(@"New!!! %@ %@", bufferChain, [[bufferChain inputNode] decoder]);
[chainQueue removeObjectAtIndex:0];
[self notifyStreamChanged:[bufferChain userInfo]]; [self notifyStreamChanged:[bufferChain userInfo]];
[output setEndOfStream:NO]; [output setEndOfStream:NO];
} }