Skip to content

Commit

Permalink
Safely dispose of dynamic delegate class pairs.
Browse files Browse the repository at this point in the history
Signed-off-by: Zachary Waldowski <zwaldowski@gmail.com>
  • Loading branch information
zwaldowski committed Jan 13, 2012
1 parent 28954d9 commit 1d5e866
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions A2DynamicDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,16 @@ - (void) dealloc
{
self.handlers = nil;

const char *className = object_getClassName(self);

[super dealloc];

// Dispose of unique A2DynamicDelegate subclass.
objc_disposeClassPair(self.class);
dispatch_async(backgroundQueue, ^{
Class cls = objc_getClass(className);

// Dispose of unique A2DynamicDelegate subclass.
objc_disposeClassPair(cls);
});
}
+ (void) load
{
Expand Down

0 comments on commit 1d5e866

Please sign in to comment.