You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a few reason that are too long to explain I empty the parent of the DOM container "by hand" after calling game.destroy(). In the 3.5 it didn't give any problem, but in the 3.6 causes endless errors.
The main issue is this code in Phaser.Game#runDestroy
As you can see it checks if this.domContainer is valid, but not for this.domContainer.parentNode.
Changing the condition like this prevents the error.
Example Test Code
I destroy de game calling this (I tried putting false as the first argument but it still gives the error); gameStage.destroy(true, true);
This is how I empty the parent container mainContDiv.innerHTML = "";
I call them one after the other in the same function. I was thinking about clearing the html inside an onDestroy event, but phaser waits a bit before removing the div, so intead of closing right away you see black for a fraction of a second, something that I want to avoid.
Additional Information
The text was updated successfully, but these errors were encountered:
Part of me thinks this is what you get for treating an async operation as synchronous (there is an event for a reason! and nothing stops you using a little CSS to hide the canvas immediately to avoid this 'black for a fraction'). However, it's also an easy guard to add in, so I'll consider it for 3.61 - just be aware there are potentially other things going on internally as well, that this won't cover.
Thanks.
I agree with you, apparently though we're not allowed to change that part of our company's framework for compatibility reasons (I proposed to use the onDestroy event).
FYI I had managed to temporarely "solve" it by doing this
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.
Version
Description
For a few reason that are too long to explain I empty the parent of the DOM container "by hand" after calling game.destroy(). In the 3.5 it didn't give any problem, but in the 3.6 causes endless errors.
![image](https://private-user-images.githubusercontent.com/102031127/255897058-5dd41aad-ed28-48fd-a627-fb66c5fcc3de.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4Nzg1MjQsIm5iZiI6MTczOTg3ODIyNCwicGF0aCI6Ii8xMDIwMzExMjcvMjU1ODk3MDU4LTVkZDQxYWFkLWVkMjgtNDhmZC1hNjI3LWZiNjZjNWZjYzNkZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxOFQxMTMwMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hNTUxYzNjOGNlODdjZjFmMDNmYmQyMjcwZTc2MWI0MjE3Zjg4ZjU0MzQxMmRjZTI0ZjYxODA5ZmQzMGJiMTI5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.8Dtm8H4NrO8e0WE4AZPRRbp8NLrB08SPhhMmQ0Ijks4)
The main issue is this code in Phaser.Game#runDestroy
![image](https://private-user-images.githubusercontent.com/102031127/255896356-215db703-1f64-4b6e-9e82-349b3aa6da5a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4Nzg1MjQsIm5iZiI6MTczOTg3ODIyNCwicGF0aCI6Ii8xMDIwMzExMjcvMjU1ODk2MzU2LTIxNWRiNzAzLTFmNjQtNGI2ZS05ZTgyLTM0OWIzYWE2ZGE1YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxOFQxMTMwMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02NGYwZDQ4NTk1ZDgxZjBiNDBmYjQ3MzYxYjkwZDJlYjZjZDliMzhhNDljZjZkYzZlMjBlYzlmZjdkN2FkYTA5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ouAi9MDl9E9scDZDaDJpUK3CZg54owVsjmDUl8ZcEAE)
As you can see it checks if this.domContainer is valid, but not for this.domContainer.parentNode.
![image](https://private-user-images.githubusercontent.com/102031127/255897312-7f02f87d-ba36-4fc5-8819-0fea828d40bc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4Nzg1MjQsIm5iZiI6MTczOTg3ODIyNCwicGF0aCI6Ii8xMDIwMzExMjcvMjU1ODk3MzEyLTdmMDJmODdkLWJhMzYtNGZjNS04ODE5LTBmZWE4MjhkNDBiYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxOFQxMTMwMjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01OWIzMzE2MzNkMjVmYzJiYzU0ODc0OWQ0OGQ2MjUwNjU5YzdhZjRlMjUwOWRlZjk1ZDM5OTZkNTg0Y2JlNTUyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.C1VhpS-wu6Gbr82H5_S544iDchEss-n1qsaZUSXzWkg)
Changing the condition like this prevents the error.
Example Test Code
I destroy de game calling this (I tried putting false as the first argument but it still gives the error);
gameStage.destroy(true, true);
This is how I empty the parent container
mainContDiv.innerHTML = "";
I call them one after the other in the same function. I was thinking about clearing the html inside an onDestroy event, but phaser waits a bit before removing the div, so intead of closing right away you see black for a fraction of a second, something that I want to avoid.
Additional Information
The text was updated successfully, but these errors were encountered: