Raitch

Cannot read property 'isDisposed' of undefined

Recommended Posts

I'm having an annoying issue that says "Cannot read property 'isDisposed' of undefined" in the canvas file in function `RenderablePrim2D.prototype._updateInstanceDataParts` where it tries to check if `gii` is disposed. But `gii` is undefined, thus breaking the entire script. I'm not fully sure how to troubleshoot this one, but if undefined is an intended behavior maybe just changing `if (gii.isDisposed)` to `if ( ! gii || gii.isDisposed)` would do it?

Ping @Nockawa

Share this post


Link to post
Share on other sites

I would really like you to find me a repro case if you can !

Other users had this bug and I tried for many hours to repro it without success..

If you can do a repro that would allow me to understand what's going on. The fix you propose is something I could do but I'd rather like to understand why it's ending in this state.

Thanks

Share this post


Link to post
Share on other sites

What are the main creation/destruction operations  you do, only at Canvas level?

Can you copy the callstack when the error occurs? 

_updateInstanceDataParts is only called during rendering and a disposed Canvas shouldn't be rendered...unless if you dispose it during the rendering phase! is it something you would do? -omg

Share this post


Link to post
Share on other sites

Narrowing it a bit down further it occurs when something is set to `.levelVisible = false`. Takes a bit to test because it only occurs at the end of the game. @Nockawa

I have a function that runs this on some ScreenSpaceCanvas2D and a lot of Group2D objects which causes it to crash after. 

Share this post


Link to post
Share on other sites

I want the callstack when the error occured, you can find it in the Debug Tools of your Web Browser, see below for an example of a crash I made on purpose, debugged with Chrome.

It contain all the methods that called themselves until the one that caused the crash, you see on the bottom the very first method: Engine._renderLoop which called "(anonymous)" (a lambda function certainly), then Scene.render, etc.

Have the callstack is useful to determine the context of a crash.

callstack.png.8f2fa76a46d4273dbd86afb83059e05a.png

Share this post


Link to post
Share on other sites
RenderablePrim2D._updateInstanceDataParts (babylon.canvas2d.js:10688)
RenderablePrim2D._prepareRenderPre (babylon.canvas2d.js:10546)
Prim2DBase._prepareRender (babylon.canvas2d.js:8908)
(anonymous) (babylon.canvas2d.js:11655)
Group2D._prepareGroupRender (babylon.canvas2d.js:11651)
(anonymous) (babylon.canvas2d.js:11673)
Group2D._prepareGroupRender (babylon.canvas2d.js:11672)
Canvas2D._updateCanvasState (babylon.canvas2d.js:17736)
Canvas2D._render (babylon.canvas2d.js:17747)
(anonymous) (babylon.canvas2d.js:16548)
Observable.notifyObservers (babylon.custom.js:3605)
Scene.render (babylon.custom.js:18697)
(anonymous) (screen.js:7622)
Engine._renderLoop (babylon.custom.js:7166)

screen.js just calls scene.render();

Does this help, @Nockawa?

Share this post


Link to post
Share on other sites

I've run into this issue a couple of times myself. I've managed to reproduce it in a playground, here.

All the pg does is put points down in the scene, and displays the distance between each (I was trying to build a measuring tool similar to the one in googleMaps when I stumbled across this issue).

This will cause the crash when the last point is removed (click to make a point, click again to remove it). Wrapping the dispose calls in a setTimeout avoids the crash (which is the workaround I'm using for now), as does changing isVisible on line 35 to true, and commenting out the levelvisible assignments on lines 87 and 94.

On an unrelated note, unless I'm missing something, it seems that picking with pointerTap and pointerUp is broken in the playground, as they always return a null pickInfo object (which is why I'm using pointerdown in the above pg).

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.