-
-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing an EditorPlugin
results in a use-after-free
#1178
Comments
I just realized ripping the Anyway, just place the MRP project alongside the |
Thanks! I ran Godot with Valgrind using one of my GDExtension projects that adds an editor plugin, and got this during shutdown:
I just posted Godot PR godotengine/godot#79492 that should prevent GDExtension from trying to access I personally think Godot (rather than godot-cpp) is the right place to fix it, because it is theoretically possible (although, basically never done at present because in most cases it would break things) to unload a GDExtension at runtime, and in that case we'd still want editor plugins to be automatically removed. Rather than increasing the number of things that break if a GDExtension is unloaded :-) I'd like to keep this accounted for. |
Godot version
4.1-stable
godot-cpp version
a9209ce
System information
Windows 11 (10.0.22621)
Issue description
When adding an
EditorPlugin
through theEditorPlugins::add_by_type
method, and then removing it in the terminator usingEditorPlugins::remove_by_type
, you will run into a use-after-free, because theEditorNode
instance on the engine side of things (which is responsible for hosting the editor plugins) has already been deallocated (at the end ofOS_*::run
) by the time the extension library terminators run inMain::cleanup
.Reverting #1138 and omitting any
EditorPlugins::remove_by_type
seems to resolve the use-after-free.Steps to reproduce
Minimal reproduction project
MRP_EditorPlugin.zip
The text was updated successfully, but these errors were encountered: