Raitch Posted March 16, 2017 Share Posted March 16, 2017 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 Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 16, 2017 Share Posted March 16, 2017 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 Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 16, 2017 Author Share Posted March 16, 2017 I will see if I can get any wiser on it. Could be that I dispose some ScreenCanvas and it gets garbage collected perhaps, but that's just a wild guess. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 16, 2017 Share Posted March 16, 2017 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 Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 16, 2017 Author Share Posted March 16, 2017 I have narrowed it down to be relevant with the `.levelVisibile` value being changed. Does that remind you of anything? Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 16, 2017 Author Share Posted March 16, 2017 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. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 16, 2017 Share Posted March 16, 2017 MasterK reported the exact same issue... Please when you had it, just copy the whole callstack and paste it here, it's a first step for me to solve it. thanks Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 16, 2017 Author Share Posted March 16, 2017 I'm not fully sure what information you want. The error? Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 16, 2017 Share Posted March 16, 2017 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. Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 16, 2017 Share Posted March 16, 2017 Ideally you want to use the version of babylon.canvas2d.js that is not minified... Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 16, 2017 Author Share Posted March 16, 2017 The error stopped showing now without any changes really :\ will see if it comes back Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 16, 2017 Author Share Posted March 16, 2017 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? Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 21, 2017 Author Share Posted March 21, 2017 Ping @Nockawa Quote Link to comment Share on other sites More sharing options...
sable Posted March 23, 2017 Share Posted March 23, 2017 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). Raitch 1 Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 24, 2017 Share Posted March 24, 2017 Hello guys, sorry, I wasn't able to work bjs last week, I'll take a look at it today, specially if @sable has a repro case! Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 24, 2017 Share Posted March 24, 2017 Ok, thanks to @sable I have a repro case! Here the GitHub issue Quote Link to comment Share on other sites More sharing options...
Nockawa Posted March 24, 2017 Share Posted March 24, 2017 @sable a big thank you! Thanks to you I could finally fix this bug! YEY! @MasterK @Raitch and other will finally be happy! a non crashing renderer will please people for sure! I've update the preview of C2D and the PG is also updated! Quote Link to comment Share on other sites More sharing options...
MasterK Posted March 25, 2017 Share Posted March 25, 2017 Good news. Quote Link to comment Share on other sites More sharing options...
Raitch Posted March 25, 2017 Author Share Posted March 25, 2017 Sweet Quote Link to comment Share on other sites More sharing options...
sable Posted March 25, 2017 Share Posted March 25, 2017 Thanks @Nockawa that's great news. 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.