fix premature release

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32453 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2011-03-05 06:11:50 +00:00
parent d0134f9b15
commit 05beb8f194
2 changed files with 11 additions and 12 deletions

View file

@ -1,3 +1,8 @@
2011-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSOperation.m: retain operation while finishing so that it
doesn't get deallocated too soon (when the queue removes it).
2011-03-04 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSNumberFormatter.m: Fix -setAllowsFloats to only operate

View file

@ -458,18 +458,7 @@ static NSArray *empty = nil;
}
NS_ENDHANDLER;
[internal->lock lock];
NS_DURING
{
[self _finish];
}
NS_HANDLER
{
[internal->lock unlock];
[localException raise];
}
NS_ENDHANDLER
[internal->lock unlock];
[self _finish];
[pool release];
}
@ -513,6 +502,10 @@ static NSArray *empty = nil;
@implementation NSOperation (Private)
- (void) _finish
{
/* retain while finishing so that we don't get deallocated when our
* queue removes and releases us.
*/
[self retain];
[internal->lock lock];
if (NO == internal->finished)
{
@ -533,6 +526,7 @@ static NSArray *empty = nil;
}
}
[internal->lock unlock];
[self release];
}
@end