11#define VerboseLog NSLog
13#define VerboseLog(...) \
21+ (id)initWithObject:(
id<NSObject>)object name:(NSString*)name;
22+ (id)initWithRetainedObject:(
id<NSObject>)object name:(NSString*)name;
32+ (id)proxyWithObject:(
id<NSObject>)object name:(NSString*)name
34 return [[[
self alloc] initWithObject:object name:name] autorelease];
37+ (id)proxyWithRetainedObject:(
id<NSObject>)object name:(NSString*)name
39 return [[[
self alloc] initWithRetainedObject:object name:name] autorelease];
42- (id)initWithObject:(
id<NSObject>)object name:(NSString*)name
47- (id)initWithRetainedObject:(
id<NSObject>)object name:(NSString*)name
50 NSLog(
@"** ReleaseLockProxy: passed nil object, returning nil proxy.");
67 NSLog(
@"** ReleaseLockProxy (%@): deallocated while locked. This shouldn't happen, unless -dealloc is being called directly.", [
self rlpObjectDescription]);
92 unsigned retainCount = [
self retainCount];
94 if (
_locked && retainCount == 1) {
96 NSLog(
@"** ReleaseLockProxy (%@): released while locked and retain count is one - intercepting retain. Something is broken.", [
self rlpObjectDescription]);
101 VerboseLog(
@"-- ReleaseLockProxy (%@): released while locked, but retain count > 1; retain count going from %u to %u.", [
self rlpObjectDescription], retainCount, retainCount - 1);
103 VerboseLog(
@"-- ReleaseLockProxy (%@): released while not locked; retain count going from %u to %u.", [
self rlpObjectDescription], retainCount, retainCount - 1);
112 return [
super autorelease];
117- (void)forwardInvocation:(NSInvocation*)invocation
122- (NSMethodSignature*)methodSignatureForSelector:(
SEL)selector
124 NSMethodSignature* result =
nil;
126 if (selector ==
@selector(initWithObject:name:) || selector ==
@selector(initWithRetainedObject:name:) || selector ==
@selector(
rlpAllowRelease) || selector ==
@selector(
rlpObjectDescription)) {
129 result = [(
id)
_object methodSignatureForSelector:selector];
135+ (BOOL)instancesRespondToSelector:(
SEL)selector
137 if (selector ==
@selector(initWithObject:name:) || selector ==
@selector(initWithRetainedObject:name:) || selector ==
@selector(
rlpAllowRelease) || selector ==
@selector(
rlpObjectDescription)) {
144- (BOOL)respondsToSelector:(
SEL)selector
153+ (id)initWithObject:(
id<NSObject>)object name:(NSString*)name
157+ (id)initWithRetainedObject:(
id<NSObject>)object name:(NSString*)name
#define NSLog(format,...)
NSString * rlpObjectDescription()
BOOL instancesRespondToSelector:(SEL selector)
NSString * rlpObjectDescription()
id initWithRetainedObject:name:(id< NSObject > object,[name] NSString *name)