crash in debug filament where the scene gets deleted before the assets
Opened this issue · 0 comments
Steps to reproduce:
- Build filament in debug mode
- Run the example app, open Animation Transition example
- Press reload
- The app will crash with an assert error saying that we tried to call
destroyMaterials
although there are still active instances.
Details
For some reason it seems that the scenes shared_ptr deleter function is called before the assets deleter functions. Thats odd because the assets deleter function depends on the scene by copy, meaning it still holds a reference to the scene, so it shouldn't be deleted yet.
Note
We ship filament as release version, and there the assert is ignored. Additionally when we destroy the engine it's actually so kind to cleanup any left over resources for us, since it's not that much of a concern.
However, we should build everything in a way that it won't crash on the filament debug build, to ensure we are using it correctly! Plus it makes debugging better (as otherwise you will get crashes in your debugging session like this one that might not be related to your actual issue at hand).