diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index b5306154badb..38e72d5532df 100644 --- a/editor/editor_file_system.cpp +++ b/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); } diff --git a/editor/editor_paths.cpp b/editor/editor_paths.cpp index 883116bab68b..5c6eed6e1a53 100644 --- a/editor/editor_paths.cpp +++ b/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() { diff --git a/tests/test_main.cpp b/tests/test_main.cpp index a0925f9a9eb6..d15e9a2d7c36 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -369,6 +369,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);