Skip to content

Commit

Permalink
Fixing crash when reimporting AtlasTextures
Browse files Browse the repository at this point in the history
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 godotengine#54817
  • Loading branch information
EspeuteClement committed May 9, 2022
1 parent 168edcd commit 1b9a2d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,7 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());

Vector<ImportFile> reimport_files;
Set<String> file_paths_already_seen;

Set<String> groups_to_reimport;

Expand All @@ -2099,11 +2100,12 @@ void EditorFileSystem::reimport_files(const Vector<String> &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);
}

Expand Down

0 comments on commit 1b9a2d1

Please sign in to comment.