Skip to content

Commit

Permalink
@nguyenhuy's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmoon committed Nov 17, 2017
1 parent 7040a11 commit 9d82d03
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Source/ASImageNode+AnimatedImage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,9 @@ - (void)_locked_setAnimatedImage:(id <ASAnimatedImageProtocol>)animatedImage
if (ASObjectIsEqual(_animatedImage, animatedImage)) {
return;
}

if (animatedImage == nil) {
// Animated image can take while to dealloc, do it off the main queue
__block id <ASAnimatedImageProtocol>deallocImage = _animatedImage;
ASPerformBlockOnBackgroundThread(^{
deallocImage = nil;
});
}

id <ASAnimatedImageProtocol> previousAnimatedImage = _animatedImage;
const id <ASAnimatedImageProtocol> previousAnimatedImage = _animatedImage;

_animatedImage = animatedImage;

if (animatedImage != nil) {
Expand All @@ -87,6 +80,11 @@ - (void)_locked_setAnimatedImage:(id <ASAnimatedImageProtocol>)animatedImage
[self setCoverImage:nil];
}

// Animated image can take while to dealloc, do it off the main queue
if (previousAnimatedImage != nil) {
ASPerformBackgroundDeallocation(previousAnimatedImage);
}

[self animatedImageSet:_animatedImage previousAnimatedImage:previousAnimatedImage];
}

Expand Down

0 comments on commit 9d82d03

Please sign in to comment.