focomoso Posted October 31, 2017 Share Posted October 31, 2017 I updated to 3.1.0-alpha3.6 and am now getting the error: "Uncaught TypeError: Cannot read property 'removeEventListener' of null" when I call engine.dispose(). The line in question is: this._renderingCanvas.removeEventListener("focus", this._onCanvasFocus); The canvas has been disposed of elsewhere and Edit: the canvas is still defined when the dispone() is called. I need to dispose of the context because this app opens and closes the gl canvas repeatedly and will evntually give a "Too many active WebGL contexts." warning. Is there a way to dispose of the context without calling .dispose()? Or is there a way to have the .dispose() method only try to remove listeners if the canvas is still defined? Thanks Quote Link to comment Share on other sites More sharing options...
focomoso Posted October 31, 2017 Author Share Posted October 31, 2017 I did some more digging and it seems that the framework I'm using (React) cleans up the canvas while the dispose method is being called. All we need to fix this is to add an if (this._renderingCanvas) {} around the _renderCanvas.removeEventListener calls. Quote Link to comment Share on other sites More sharing options...
focomoso Posted October 31, 2017 Author Share Posted October 31, 2017 Strange... I went to do a pr to make this change myself and the version [email protected] already has this in, but when I get the package with npm, it's not there... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 31, 2017 Share Posted October 31, 2017 Yeah we did not updated npm yet Quote Link to comment Share on other sites More sharing options...
RaananW Posted November 1, 2017 Share Posted November 1, 2017 Will arrive in [email protected], we will publich a new npm package soon. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.