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
As far as I can tell this looks to be a bug/regression introduced in #83747. I only noticed it when running the editor under Application Verifier on Windows, which similar to Valgrind lets you know if a use-after-free has occurred, among other things.
I haven't noticed any crash when running normally, but I suppose that could maybe happen, given the somewhat random nature of a use-after-free.
Basically, when closing the editor while a GDExtension (using godot-cpp) is loaded, that has itself registered a class with ClassDB, it will seemingly trigger a use-after-free here:
Tested versions
Reproducible in: 4.3.rc [739019e]
System information
Windows 11 (10.0.22631)
Issue description
As far as I can tell this looks to be a bug/regression introduced in #83747. I only noticed it when running the editor under Application Verifier on Windows, which similar to Valgrind lets you know if a use-after-free has occurred, among other things.
I haven't noticed any crash when running normally, but I suppose that could maybe happen, given the somewhat random nature of a use-after-free.
Basically, when closing the editor while a GDExtension (using godot-cpp) is loaded, that has itself registered a class with
ClassDB
, it will seemingly trigger a use-after-free here:godot/editor/editor_help.cpp
Lines 2879 to 2881 in 739019e
... as
doc
will already have been freed at that point, but not zeroed out.The flow goes something like this:
SceneTree::finalize
is calledEditorNode
is deletedEditorNode::~EditorNode
callsEditorHelp::cleanup_doc
EditorHelp::cleanup_doc
deletesEditorHelp::doc
(but doesn't zero it out)Main::cleanup
is called (later down the line)Main::cleanup
callsGDExtensionManager::deinitialize_extensions
(withINITIALIZATION_LEVEL_EDITOR
in my case)ClassDB::deinitialize
ClassDB::deinitialize
calls into Godot'sGDExtension::_unregister_extension_class
GDExtension::_unregister_extension_class
callsGDExtensionEditorHelp::remove_class
GDExtensionEditorHelp::remove_class
callsEditorHelp::remove_class
Simply adding a
doc = nullptr
inEditorHelp::cleanup_doc
seems to resolve the issue.Steps to reproduce
N/A
Minimal reproduction project (MRP)
I'd be happy to provide an MRP, but I'm fairly sure this should be reproducible in pretty much any godot-cpp project.
The text was updated successfully, but these errors were encountered: