Oolite
Loading...
Searching...
No Matches
ReleaseLockProxy Class Reference

#include <ReleaseLockProxy.h>

Inheritance diagram for ReleaseLockProxy:
Collaboration diagram for ReleaseLockProxy:

Instance Methods

(id) - initWithObject:name:
(id) - initWithRetainedObject:name:
(void) - rlpAllowRelease
(NSString *) - rlpObjectDescription
(void) - dealloc [implementation]
(void) - release [implementation]
(id) - autorelease [implementation]
(void) - forwardInvocation: [implementation]
(NSMethodSignature *) - methodSignatureForSelector: [implementation]
(BOOL) - respondsToSelector: [implementation]

Class Methods

(id) + proxyWithObject:name:
(id) + proxyWithRetainedObject:name:
(BOOL) + instancesRespondToSelector: [implementation]

Private Attributes

id< NSObject > _object
NSString * _name
BOOL _locked

Detailed Description

Definition at line 14 of file ReleaseLockProxy.h.

Method Documentation

◆ autorelease

- (id) autorelease
implementation

Definition at line 109 of file ReleaseLockProxy.m.

110{
111 VerboseLog(@"-- ReleaseLockProxy (%@): autoreleased while %slocked and retain count at %u.", [self rlpObjectDescription], _locked ? "" : "not ", [self retainCount]);
112 return [super autorelease];
113}
#define VerboseLog(...)
NSString * rlpObjectDescription()

References _locked, autorelease, rlpObjectDescription, and VerboseLog.

Referenced by autorelease.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dealloc

- (void) dealloc
implementation

Definition at line 64 of file ReleaseLockProxy.m.

65{
66 if (_locked) {
67 NSLog(@"** ReleaseLockProxy (%@): deallocated while locked. This shouldn't happen, unless -dealloc is being called directly.", [self rlpObjectDescription]);
68 } else {
69 VerboseLog(@"-- ReleaseLockProxy (%@): deallocated while not locked.", [self rlpObjectDescription]);
70 }
71
72 [_object release];
73 [_name release];
74
75 [super dealloc];
76}
#define NSLog(format,...)
Definition OOLogging.h:148

References _locked, dealloc, NSLog, rlpObjectDescription, and VerboseLog.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forwardInvocation:

- (void) forwardInvocation: (NSInvocation*) invocation
implementation

Definition at line 117 of file ReleaseLockProxy.m.

117 :(NSInvocation*)invocation
118{
119 [invocation invokeWithTarget:_object];
120}

◆ initWithObject:name:

- (id) initWithObject: (id<NSObject>) object
name: (NSString*) name 

Definition at line 42 of file ReleaseLockProxy.m.

42 :(id<NSObject>)object name:(NSString*)name
43{
44 return [self initWithRetainedObject:[object retain] name:name];
45}

References initWithRetainedObject:name:.

Here is the call graph for this function:

◆ initWithRetainedObject:name:

- (id) initWithRetainedObject: (id<NSObject>) object
name: (NSString*) name 

Definition at line 47 of file ReleaseLockProxy.m.

47 :(id<NSObject>)object name:(NSString*)name
48{
49 if (object == nil) {
50 NSLog(@"** ReleaseLockProxy: passed nil object, returning nil proxy.");
51 [self release];
52 return nil;
53 }
54
55 // No super init for proxies.
56
57 _object = object;
58 _name = [name copy];
59 _locked = YES;
60
61 return self;
62}
return nil
id< NSObject > _object

References _locked, _name, _object, nil, NSLog, and release.

Referenced by initWithObject:name:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ instancesRespondToSelector:

+ (BOOL) instancesRespondToSelector: (SEL) selector
implementation

Definition at line 135 of file ReleaseLockProxy.m.

135 :(SEL)selector
136{
137 if (selector == @selector(initWithObject:name:) || selector == @selector(initWithRetainedObject:name:) || selector == @selector(rlpAllowRelease) || selector == @selector(rlpObjectDescription)) {
138 return YES;
139 } else {
140 return NO;
141 }
142}

References rlpAllowRelease, and rlpObjectDescription.

Referenced by respondsToSelector:.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ methodSignatureForSelector:

- (NSMethodSignature *) methodSignatureForSelector: (SEL) selector
implementation

Definition at line 122 of file ReleaseLockProxy.m.

122 :(SEL)selector
123{
124 NSMethodSignature* result = nil;
125
126 if (selector == @selector(initWithObject:name:) || selector == @selector(initWithRetainedObject:name:) || selector == @selector(rlpAllowRelease) || selector == @selector(rlpObjectDescription)) {
127 result = [ReleaseLockProxy_SignatureTemplateClass methodSignatureForSelector:selector];
128 } else {
129 result = [(id)_object methodSignatureForSelector:selector];
130 }
131
132 return result;
133}

References _object, nil, rlpAllowRelease, and rlpObjectDescription.

Here is the call graph for this function:

◆ proxyWithObject:name:

+ (id) proxyWithObject: (id<NSObject>) object
name: (NSString*) name 

Definition at line 32 of file ReleaseLockProxy.m.

32 :(id<NSObject>)object name:(NSString*)name
33{
34 return [[[self alloc] initWithObject:object name:name] autorelease];
35}

◆ proxyWithRetainedObject:name:

+ (id) proxyWithRetainedObject: (id<NSObject>) object
name: (NSString*) name 

Definition at line 37 of file ReleaseLockProxy.m.

37 :(id<NSObject>)object name:(NSString*)name
38{
39 return [[[self alloc] initWithRetainedObject:object name:name] autorelease];
40}

◆ release

- (void) release
implementation

Definition at line 90 of file ReleaseLockProxy.m.

91{
92 unsigned retainCount = [self retainCount];
93
94 if (_locked && retainCount == 1) {
95 // Breakpoint here to catch what would otherwise be the last release before crashing.
96 NSLog(@"** ReleaseLockProxy (%@): released while locked and retain count is one - intercepting retain. Something is broken.", [self rlpObjectDescription]);
97 return;
98 }
99
100 if (_locked) {
101 VerboseLog(@"-- ReleaseLockProxy (%@): released while locked, but retain count > 1; retain count going from %u to %u.", [self rlpObjectDescription], retainCount, retainCount - 1);
102 } else {
103 VerboseLog(@"-- ReleaseLockProxy (%@): released while not locked; retain count going from %u to %u.", [self rlpObjectDescription], retainCount, retainCount - 1);
104 }
105
106 [super release];
107}

References _locked, NSLog, release, rlpObjectDescription, and VerboseLog.

Referenced by initWithRetainedObject:name:, and release.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ respondsToSelector:

- (BOOL) respondsToSelector: (SEL) selector
implementation

Definition at line 144 of file ReleaseLockProxy.m.

144 :(SEL)selector
145{
147}
BOOL instancesRespondToSelector:(SEL selector)

References instancesRespondToSelector:.

Here is the call graph for this function:

◆ rlpAllowRelease

- (void) rlpAllowRelease

Definition at line 78 of file ReleaseLockProxy.m.

79{
80 _locked = NO;
81}

References _locked, and rlpAllowRelease.

Referenced by instancesRespondToSelector:, methodSignatureForSelector:, and rlpAllowRelease.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rlpObjectDescription

- (NSString *) rlpObjectDescription

Definition at line 83 of file ReleaseLockProxy.m.

84{
85 return _name ? _name : [_object description];
86}

References _name, and rlpObjectDescription.

Referenced by autorelease, dealloc, instancesRespondToSelector:, methodSignatureForSelector:, release, and rlpObjectDescription.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _locked

- (BOOL) _locked
private

Definition at line 18 of file ReleaseLockProxy.h.

Referenced by autorelease, dealloc, initWithRetainedObject:name:, release, and rlpAllowRelease.

◆ _name

- (NSString*) _name
private

Definition at line 17 of file ReleaseLockProxy.h.

Referenced by initWithRetainedObject:name:, and rlpObjectDescription.

◆ _object

- (id<NSObject>) _object
private

Definition at line 16 of file ReleaseLockProxy.h.

Referenced by initWithRetainedObject:name:, and methodSignatureForSelector:.


The documentation for this class was generated from the following files: