Open MikeSchulze opened 1 year ago
This happens because the destructor sets the PhysicsServer3D
singleton to nullptr
.
To avoid this we could take the approach used by TextServer
, which is to make the servers RefCounted
:
and let the server manager (singleton) keep a reference to the primary implementation:
This would fix the issue, though I don't think it's very high priority, and we would have to find a good replacement for the ~400 occurrences of PhysicsServer3D::get_singleton()
in the existing code base. I'm not a big fan of using an acronym like
instead of something more explicit. Maybe PhysicsServer3D::get_singleton()
could remain and we make it call the manager instead, which would be a simple solution though it feels slightly dirty. cc @bruvzg for thoughts on the design/style.
Godot version
v4.0.beta3.official [01ae26d31]
System information
windows 10
Issue description
I run in this issue while migration my unit test api. To test extraction of class names from engine classes i loop over all engine classes provided by
ClassDB.get_class_list()
My test aborts without any reason, no error in the consoleAfter adding more log infos i find out freeing a instance of
PhysicsServer3DExtension
aborts function calls without any error.Steps to reproduce
Run the code and you see the line
prints("freed")
is not executed.To force to see the "real" error i try to add an extra await process_frame Rerun the code and comment in the line![image](https://user-images.githubusercontent.com/347037/196784958-345e8b0f-a933-406d-ab9a-8d21170400bd.png)
# await get_tree().process_frame
Now an error is shownYou can run over all engine classes and see the debuger crashes randomly. The line
prints("--- Done ---")
is never calledMinimal reproduction project
No response