Fix retain/release error which caused a crash on removal of an old operation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39877 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-06-19 07:37:58 +00:00
parent 00cec80391
commit 21d242b151

View file

@ -920,7 +920,7 @@ static NSOperationQueue *mainQueue = nil;
when = [[NSDate alloc] initWithTimeIntervalSinceNow: 5.0]; when = [[NSDate alloc] initWithTimeIntervalSinceNow: 5.0];
found = [internal->cond lockWhenCondition: 1 beforeDate: when]; found = [internal->cond lockWhenCondition: 1 beforeDate: when];
[when release]; RELEASE(when);
if (NO == found) if (NO == found)
{ {
break; // Idle for 5 seconds ... exit thread. break; // Idle for 5 seconds ... exit thread.
@ -928,7 +928,7 @@ static NSOperationQueue *mainQueue = nil;
if ([internal->starting count] > 0) if ([internal->starting count] > 0)
{ {
op = [internal->starting objectAtIndex: 0]; op = RETAIN([internal->starting objectAtIndex: 0]);
[internal->starting removeObjectAtIndex: 0]; [internal->starting removeObjectAtIndex: 0];
} }
else else
@ -958,7 +958,7 @@ static NSOperationQueue *mainQueue = nil;
[NSThread setThreadPriority: [op threadPriority]]; [NSThread setThreadPriority: [op threadPriority]];
[op main]; [op main];
} }
[opPool release]; RELEASE(opPool);
} }
NS_HANDLER NS_HANDLER
{ {
@ -967,6 +967,7 @@ static NSOperationQueue *mainQueue = nil;
} }
NS_ENDHANDLER NS_ENDHANDLER
[op _finish]; [op _finish];
RELEASE(op);
} }
} }
@ -974,7 +975,7 @@ static NSOperationQueue *mainQueue = nil;
[internal->lock lock]; [internal->lock lock];
internal->threadCount--; internal->threadCount--;
[internal->lock unlock]; [internal->lock unlock];
[pool release]; RELEASE(pool);
[NSThread exit]; [NSThread exit];
} }