Protect against dealloc before init

This commit is contained in:
rfm 2024-11-14 17:57:55 +00:00
parent 43484b2c34
commit bb57918f70

View file

@ -199,7 +199,9 @@ static NSArray *empty = nil;
- (void) dealloc
{
if (internal != nil)
/* Only clean up if ivars have been initialised
*/
if (internal && internal->lock)
{
NSOperation *op;
@ -832,7 +834,8 @@ static NSOperationQueue *mainQueue = nil;
internal->cond = [[NSConditionLock alloc] initWithCondition: 0];
[internal->cond setName:
[NSString stringWithFormat: @"cond-for-op-%p", self]];
internal->name = [[NSString alloc] initWithFormat: @"NSOperationQueue %p", self];
internal->name
= [[NSString alloc] initWithFormat: @"NSOperationQueue %p", self];
/* Ensure that default thread name can be displayed on systems with a
* limited thread name length.