浏览代码

Merge pull request #99847 from demolke/editorpaths

Destroy EditorFilesystem/EditorSettings on test shutdown
Thaddeus Crews 9 月之前
父节点
当前提交
781c6a82b0
共有 3 个文件被更改,包括 8 次插入0 次删除
  1. 4 0
      editor/editor_file_system.cpp
  2. 1 0
      editor/editor_paths.cpp
  3. 3 0
      tests/test_main.cpp

+ 4 - 0
editor/editor_file_system.cpp

@@ -3556,5 +3556,9 @@ EditorFileSystem::EditorFileSystem() {
 }
 
 EditorFileSystem::~EditorFileSystem() {
+	if (filesystem) {
+		memdelete(filesystem);
+	}
+	filesystem = nullptr;
 	ResourceSaver::set_get_resource_id_for_path(nullptr);
 }

+ 1 - 0
editor/editor_paths.cpp

@@ -105,6 +105,7 @@ void EditorPaths::create() {
 void EditorPaths::free() {
 	ERR_FAIL_NULL(singleton);
 	memdelete(singleton);
+	singleton = nullptr;
 }
 
 void EditorPaths::_bind_methods() {

+ 3 - 0
tests/test_main.cpp

@@ -370,6 +370,9 @@ struct GodotTestCaseListener : public doctest::IReporter {
 		if (EditorSettings::get_singleton()) {
 			EditorSettings::destroy();
 		}
+		if (EditorPaths::get_singleton()) {
+			EditorPaths::free();
+		}
 #endif // TOOLS_ENABLED
 
 		Engine::get_singleton()->set_editor_hint(false);