From d96c58bbd0f94418e6dc76a9766d28a595eaeb16 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Sun, 16 Jun 2024 17:44:51 +0300 Subject: [PATCH] [Editor] Unload addons before quitting to allow cleanup. --- editor/editor_node.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d5e12424065..42045453e31 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -3322,6 +3322,13 @@ void EditorNode::_exit_editor(int p_exit_code) { // Dim the editor window while it's quitting to make it clearer that it's busy. dim_editor(true); + // Unload addons before quitting to allow cleanup. + for (const KeyValue &E : addon_name_to_plugin) { + print_verbose(vformat("Unloading addon: %s", E.key)); + remove_editor_plugin(E.value, false); + memdelete(E.value); + } + get_tree()->quit(p_exit_code); }