Line data Source code
1 0 : /* ReleaseLockProxy.h 2 : By Jens Ayton 3 : This code is hereby placed in the public domain. 4 : 5 : Hacky debug utility. 6 : A ReleaseLockProxy proxies an object, and stops the proxied object from 7 : being released until -rlpAllowRelease is called. All releases are logged, 8 : and one that would cause the object to die is stopped. Breakpoints in 9 : release may be handy. 10 : */ 11 : 12 : #import <Foundation/Foundation.h> 13 : 14 : 15 0 : @interface ReleaseLockProxy: NSProxy 16 : { 17 : @private 18 0 : id<NSObject> _object; 19 0 : NSString *_name; 20 0 : BOOL _locked; 21 : } 22 : 23 0 : + (id)proxyWithObject:(id<NSObject>)object name:(NSString *)name; 24 0 : + (id)proxyWithRetainedObject:(id<NSObject>)object name:(NSString *)name; // Doesn't retain the object 25 : 26 0 : - (id)initWithObject:(id<NSObject>)object name:(NSString *)name; 27 0 : - (id)initWithRetainedObject:(id<NSObject>)object name:(NSString *)name; // Doesn't retain the object 28 : 29 0 : - (void)rlpAllowRelease; 30 0 : - (NSString *)rlpObjectDescription; // name if not nil, otherwise object description. 31 : 32 : @end