Move dealloc method from ASImageNode+AnimatedImage category to ASImageNode

Having a dealloc method in a category can be very problematic as the superclass dealloc method will not be called in case it exists.
This commit is contained in:
Michael Schneider
2016-07-08 14:41:19 -07:00
parent ac9549ee89
commit b2810edb0f
3 changed files with 18 additions and 1 deletions

View File

@@ -233,7 +233,11 @@ NSString *const ASAnimatedImageDefaultRunLoopMode = NSRunLoopCommonModes;
return frameIndex;
}
- (void)dealloc
@end
@implementation ASImageNode(AnimatedImageInvalidation)
- (void)invalidateAnimatedImage
{
ASDN::MutexLocker l(_displayLinkLock);
#if ASAnimatedImageDebug

View File

@@ -110,6 +110,12 @@ struct ASImageNodeDrawParameters {
return nil;
}
- (void)dealloc
{
// Invalidate all components around animated images
[self invalidateAnimatedImage];
}
#pragma mark - Layout and Sizing
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize

View File

@@ -31,3 +31,10 @@ extern NSString *const ASAnimatedImageDefaultRunLoopMode;
@property (atomic, assign) CFTimeInterval lastDisplayLinkFire;
@end
@interface ASImageNode (AnimatedImageInvalidation)
- (void)invalidateAnimatedImage;
@end