浏览代码

[Editor] Unload addons before quitting to allow cleanup.

bruvzg 1 年之前
父节点
当前提交
d96c58bbd0
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      editor/editor_node.cpp

+ 7 - 0
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 the editor window while it's quitting to make it clearer that it's busy.
 	dim_editor(true);
 	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);
 	get_tree()->quit(p_exit_code);
 }
 }