Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.85k stars 819 forks source link

Disposing & Recreating Starling broken #906

Closed neuronix closed 7 years ago

neuronix commented 7 years ago

Hi Daniel,

We have a "reboot" sequence in our apps that we use after changing language or after an error for example. We get rid of the current data, remove all handlers and dispose Starling etc. Then we start all up again.

This worked fine on the initial 2.0 release and the issue appeared with 2.01, can't say which commit because I noticed when I took the dev version on Github.

Herewith a test case: https://gist.github.com/neuronix/d81431c278eea4849a64580c78748150

Issue 1. After "rebooting", Image does not display at all..

Issue 2. You have to wait a frame between disposing starling children and disposing the starling instance (workaround is easy though)

Thanks for your help Daniel!

PrimaryFeather commented 7 years ago

Thanks a lot for the report! It turned out that I forgot to dispose the "Painter" (and thus, the "context") when disposing Starling. The second instance than thought it would share the context with somebody else, and didn't do all the work it should.

That should solve both issues! Thanks also for the excellent test case, that made finding the problem very simple for me. :smile:

neuronix commented 7 years ago

Happy there was a quick fix! :)