Skip to content

Commit 0081cf0

Browse files
fix(🌍): add recorder.dispose() to all 4 call sites for RN Web (#3699)
Co-authored-by: William Candillon <wcandillon@gmail.com>
1 parent cbdf150 commit 0081cf0

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

β€Žpackages/skia/src/renderer/Offscreen.tsxβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const drawAsPicture = async (element: ReactElement, bounds?: SkRect) => {
2020
await root.render(element);
2121
root.drawOnCanvas(canvas);
2222
const picture = recorder.finishRecordingAsPicture();
23+
recorder.dispose();
2324
root.unmount();
2425
return picture;
2526
};

β€Žpackages/skia/src/sksg/Container.web.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {
2121
const ctx = createDrawingContext(Skia, recording.paintPool, canvas);
2222
replay(ctx, recording.commands);
2323
const picture = rec.finishRecordingAsPicture();
24+
rec.dispose();
2425
//const end = performance.now();
2526
//console.log("Recording time: ", end - start);
2627
SkiaViewApi.setJsiProperty(nativeId, "picture", picture);

β€Žpackages/skia/src/sksg/Reconciler.tsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export class SkiaSGRoot {
6565
const recorder = this.Skia.PictureRecorder();
6666
const canvas = recorder.beginRecording();
6767
this.drawOnCanvas(canvas);
68-
return recorder.finishRecordingAsPicture();
68+
const picture = recorder.finishRecordingAsPicture();
69+
recorder.dispose();
70+
return picture;
6971
}
7072

7173
unmount() {

β€Žpackages/skia/src/sksg/StaticContainer.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export class StaticContainer extends Container {
6565
const canvas = rec.beginRecording();
6666
this.drawOnCanvas(canvas);
6767
const picture = rec.finishRecordingAsPicture();
68+
rec.dispose();
6869
SkiaViewApi.setJsiProperty(this.nativeId, "picture", picture);
6970
}
7071
}

0 commit comments

Comments
Β (0)