mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
added autorelease pool around each operation to catch any autoreleased
objects produced by the operation being executed. This should prevent objects living until the end of the thread.
This commit is contained in:
parent
6ae48bd3d3
commit
98dfa140ec
1 changed files with 7 additions and 1 deletions
|
@ -538,7 +538,7 @@ static NSArray *empty = nil;
|
|||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation NSBlockOperation
|
||||
|
||||
+ (instancetype) blockOperationWithBlock: (GSBlockOperationBlock)block
|
||||
|
@ -989,6 +989,11 @@ static NSOperationQueue *mainQueue = nil;
|
|||
forKey: threadKey];
|
||||
for (;;)
|
||||
{
|
||||
/* We use a pool for each operation in case releasing the operation
|
||||
* causes it to be deallocated, and the deallocation of the operation
|
||||
* autoreleases something which needs to be cleaned up.
|
||||
*/
|
||||
ENTER_POOL
|
||||
NSOperation *op;
|
||||
NSDate *when;
|
||||
BOOL found;
|
||||
|
@ -1040,6 +1045,7 @@ static NSOperationQueue *mainQueue = nil;
|
|||
[op _finish];
|
||||
RELEASE(op);
|
||||
}
|
||||
LEAVE_POOL
|
||||
}
|
||||
|
||||
[[[NSThread currentThread] threadDictionary] removeObjectForKey: threadKey];
|
||||
|
|
Loading…
Reference in a new issue