@@ -17,24 +17,21 @@ #include "config.h" #import "OFStillLockedException.h" #import "OFString.h" -#import "macros.h" +#import "common.h" @implementation OFStillLockedException -+ (instancetype)exceptionWithClass: (Class)class - lock: (id )lock ++ (instancetype)exceptionWithLock: (id )lock { - return [[[self alloc] initWithClass: class - lock: lock] autorelease]; + return [[[self alloc] initWithLock: lock] autorelease]; } -- initWithClass: (Class)class - lock: (id )lock +- initWithLock: (id )lock { - self = [super initWithClass: class]; + self = [super init]; _lock = [lock retain]; return self; } @@ -46,15 +43,19 @@ [super dealloc]; } - (OFString*)description { - return [OFString stringWithFormat: - @"Deallocation of a lock of type %@ was tried in class %@, even " - @"though it was still locked!", [_lock class], _inClass]; + if (_lock != nil) + return [OFString stringWithFormat: + @"Deallocation of a lock of type %@ even though it was " + @"still locked!", [_lock class]]; + else + return @"Deallocation of a lock even though it was still " + @"locked!"; } - (id )lock { OF_GETTER(_lock, false) } @end