|
@@ -560,7 +560,16 @@ extension AnimatedImageView {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- animatedFrames[previousFrameIndex] = animatedFrames[previousFrameIndex]?.placeholderFrame
|
|
|
|
|
|
|
+ let previousFrame = animatedFrames[previousFrameIndex]
|
|
|
|
|
+ animatedFrames[previousFrameIndex] = previousFrame?.placeholderFrame
|
|
|
|
|
+ // ensure the image dealloc in main thread
|
|
|
|
|
+ defer {
|
|
|
|
|
+ if let image = previousFrame?.image {
|
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
|
+ _ = image
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
preloadIndexes(start: currentFrameIndex).forEach { index in
|
|
preloadIndexes(start: currentFrameIndex).forEach { index in
|
|
|
guard let currentAnimatedFrame = animatedFrames[index] else { return }
|
|
guard let currentAnimatedFrame = animatedFrames[index] else { return }
|