Skip to content

Commit

Permalink
fix leak in testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Jan 10, 2025
1 parent 506710c commit afa5035
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions Tests/base/NSKVOSupport/general.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ - (id)init
- (void)dealloc
{
[self removeObserver:self forKeyPath:@"dummy"];
[super dealloc];
DESTROY(_dummy);
DEALLOC
}
@end

@interface TestKVOChange : NSObject {
NSString *_keypath;
id _object;
NSDictionary *_info;
void *_context;
NSString *_keypath;
id _object;
NSDictionary *_info;
void *_context;
}

- (NSString *)keypath;
Expand Down Expand Up @@ -116,6 +117,14 @@ + (id) changeWithKeypath: (NSString *)keypath
return change;
}

- (void) dealloc
{
DESTROY(_keypath);
DESTROY(_object);
DESTROY(_info);
DEALLOC
}

- (NSString *) keypath
{
return _keypath;
Expand Down Expand Up @@ -164,14 +173,6 @@ - (void) setContext:(void *)newContext
_context = newContext;
}

- (void) dealloc
{
[_object release];
[_keypath release];
[_info release];
[super dealloc];
}

@end

@interface TestKVOObserver : NSObject
Expand Down Expand Up @@ -241,7 +242,8 @@ - (NSInteger)numberOfObservedChanges
return accumulator;
}

- (void) dealloc {
- (void) dealloc
{
[_lock release];
[_changedKeypaths release];
DEALLOC
Expand Down Expand Up @@ -288,21 +290,21 @@ - (void)incrementManualIntegerProperty;
*/

@interface TestKVOObject : NSObject {
NSString *_internal_derivedObjectProperty;
NSString *_internal_keyDerivedTwoTimes;
int _manuallyNotifyingIntegerProperty;
int _ivarWithoutSetter;

NSString *_nonNotifyingObjectProperty;
NSString *_basicObjectProperty;
uint32_t _basicPodProperty;
struct TestKVOStruct _structProperty;
TestKVOObject *_cascadableKey;
id _recursiveDependent1;
id _recursiveDependent2;
NSMutableDictionary *_dictionaryProperty;
id _boolTrigger1;
id _boolTrigger2;
NSString *_internal_derivedObjectProperty;
NSString *_internal_keyDerivedTwoTimes;
int _manuallyNotifyingIntegerProperty;
int _ivarWithoutSetter;

NSString *_nonNotifyingObjectProperty;
NSString *_basicObjectProperty;
uint32_t _basicPodProperty;
struct TestKVOStruct _structProperty;
TestKVOObject *_cascadableKey;
id _recursiveDependent1;
id _recursiveDependent2;
NSMutableDictionary *_dictionaryProperty;
id _boolTrigger1;
id _boolTrigger2;
}

- (NSString *)nonNotifyingObjectProperty;
Expand Down Expand Up @@ -358,7 +360,8 @@ - (void)dealloc
[_dictionaryProperty release];
[_boolTrigger1 release];
[_boolTrigger2 release];
[super dealloc];

DEALLOC
}

+ (NSSet *)keyPathsForValuesAffectingDerivedObjectProperty
Expand Down

0 comments on commit afa5035

Please sign in to comment.