Skip to content

Commit d366abd

Browse files
authored
fix(🐎): fix serious threading issue in useAnimatedImageValue (#3057)
1 parent 534d2c8 commit d366abd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/skia/src/external/reanimated/useAnimatedImageValue.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ export const useAnimatedImageValue = (
4040

4141
// Update the current frame
4242
animatedImage.decodeNextFrame();
43-
if (currentFrame.value) {
44-
currentFrame.value.dispose();
45-
}
43+
const oldFrame = currentFrame.value;
4644
currentFrame.value = animatedImage.getCurrentFrame();
45+
if (oldFrame) {
46+
oldFrame.dispose();
47+
}
4748

4849
// Update the last timestamp
4950
lastTimestamp.value = timestamp;

0 commit comments

Comments
 (0)