Skip to content

Commit

Permalink
Add test to exercise the crash reported in issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ash authored and Michael Ash committed Jan 10, 2013
1 parent a9ec557 commit d489d44
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions PLWeakCompatibilityTests/PLWeakCompatibilityTests.m
Expand Up @@ -49,6 +49,15 @@ - (void) dealloc { \
@interface PLWeakCompatibilityEmptyTestSubclass : NSObject @end
@implementation PLWeakCompatibilityEmptyTestSubclass @end

@interface PLWeakCompatibilityManipulateSelfInDeallocClass : NSObject @end
@implementation PLWeakCompatibilityManipulateSelfInDeallocClass

- (void) dealloc {
CFRelease(CFBridgingRetain(self));
}

@end

@implementation PLWeakCompatibilityTests

- (void) enumerateConfigurations: (void (^)(void)) block {
Expand Down Expand Up @@ -255,4 +264,13 @@ - (void) testMultithreadedRelease {
}];
}

- (void) testReleaseInDealloc {
[self enumerateConfigurations: ^{
id obj = [[PLWeakCompatibilityManipulateSelfInDeallocClass alloc] init];
__weak id weakObj = obj;
[obj self];
[weakObj self];
}];
}

@end

0 comments on commit d489d44

Please sign in to comment.