Skip to content

Commit

Permalink
patch: Only clean up the Renderer object if it is a CanvasRenderer, a…
Browse files Browse the repository at this point in the history
…s WebGL Renderer does not need to be deleted

Original issue: #333

Only the canvas renderer can have its emscripten object deleted on cleanup, but not the WebGL one. So just adding a quick check to only delete if it detects the runtime has a canvas renderer.

Diffs=
c579540d1 patch: Only clean up the Renderer object if it is a CanvasRenderer, as WebGL Renderer does not need to be deleted (#6037)

Co-authored-by: Zachary Plata <[email protected]>
  • Loading branch information
zplata and zplata committed Nov 20, 2023
1 parent 33e5609 commit 2df6145
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fdad661369bfa0092a2de92c02bf106da87977de
c579540d144e3f89bc92149920e37eb78540888e
7 changes: 5 additions & 2 deletions js/src/rive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,11 @@ export class Rive {
this.stopRendering();
// Clean up any artboard, animation or state machine instances.
this.cleanupInstances();
// Delete the renderer
this.renderer?.delete();
// Only CanvasRenderer needs a delete for now, not WebGL.. might be a better
// way to detect this in the future
if (this.runtime?.CanvasRenderer) {
this.renderer?.delete();
}
this.renderer = null;
// Delete the rive file
this.file?.delete();
Expand Down

0 comments on commit 2df6145

Please sign in to comment.