Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

destroy instance is incomplete? #50

Closed
digitaljohn opened this issue Oct 19, 2019 · 0 comments · Fixed by #51
Closed

destroy instance is incomplete? #50

digitaljohn opened this issue Oct 19, 2019 · 0 comments · Fixed by #51

Comments

@digitaljohn
Copy link
Contributor

I'm using glslCanvas within a react app and am failing to cleanly destroy the instance.
It appears the render loop does not get aborted so causes an error after the destruction?

My hook looks like this:

// Spawn the glsl canvas
  useEffect(() => {
    if (!webGlSupported && GlslCanvas) return;
    sandbox.current = new GlslCanvas(canvas.current);
    return () => {
      sandbox.current.pause();
      sandbox.current.destroy();
    };
  }, [webGlSupported]);

This causes an error:

Uncaught TypeError: Cannot read property 'canvas' of null
    at GlslCanvas.resize (GlslCanvas.es.js:1394)
    at RenderLoop (GlslCanvas.es.js:1084)

Related: #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant