From 1b9a2d1f735b2493a9ff3f9c7ac300f7f4b460d1 Mon Sep 17 00:00:00 2001 From: cespeute Date: Sun, 8 May 2022 16:43:49 +0200 Subject: [PATCH] Fixing crash when reimporting AtlasTextures The crash was caused by the reimport_files function trying to reimport the atlas file multiple times using multithreading, which caused deadlocks and hang the editor. This fix prevents files from being added to the reimport_files array if they are already present inside of it. Fixes #54817 --- editor/editor_file_system.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 099dfe69d5f7..bbb82b37663e 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -2078,6 +2078,7 @@ void EditorFileSystem::reimport_files(const Vector &p_files) { EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size()); Vector reimport_files; + Set file_paths_already_seen; Set groups_to_reimport; @@ -2099,11 +2100,12 @@ void EditorFileSystem::reimport_files(const Vector &p_files) { } else if (!group_file.is_empty()) { //it's a group file, add group to import and skip this file groups_to_reimport.insert(group_file); - } else { + } else if (!file_paths_already_seen.has(file)) { //it's a regular file ImportFile ifile; ifile.path = file; ResourceFormatImporter::get_singleton()->get_import_order_threads_and_importer(file, ifile.order, ifile.threaded, ifile.importer); + file_paths_already_seen.insert(file); reimport_files.push_back(ifile); }