Merge pull request #93238 from bruvzg/ed_unload_addons

[Editor] Unload addons before quitting to allow cleanup.
This commit is contained in:
Rémi Verschelde 2024-06-18 17:59:16 +02:00
commit edf2f8cb0d
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -3324,6 +3324,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<String, EditorPlugin *> &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);
}