diff --git a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m index 5aaa3e68..0d325833 100644 --- a/doric-iOS/Pod/Classes/Shader/DoricImageNode.m +++ b/doric-iOS/Pod/Classes/Shader/DoricImageNode.m @@ -683,6 +683,14 @@ - (void)reset { self.imageScale = UIScreen.mainScreen.scale; self.blurEffectView = nil; self.view.contentMode = UIViewContentModeScaleAspectFill; + if (self.animationEndCallbackId) { +#if DORIC_USE_YYWEBIMAGE + [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentIsPlayingAnimation" context:nil]; +#elif DORIC_USE_SDWEBIMAGE + [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentFrameIndex" context:nil]; +#endif + self.animationEndCallbackId = nil; + } } - (BOOL)needReload { @@ -697,10 +705,12 @@ - (BOOL)needReload { } - (void)dealloc { + if (self.animationEndCallbackId) { #if DORIC_USE_YYWEBIMAGE - [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentIsPlayingAnimation" context:nil]; + [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentIsPlayingAnimation" context:nil]; #elif DORIC_USE_SDWEBIMAGE - [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentFrameIndex" context:nil]; + [(DoricImageView *) self.view removeObserver:self forKeyPath:@"currentFrameIndex" context:nil]; #endif + } } @end