Merge pull request #93161 from Hilderin/fix-crash-importing-ttf

Fix ProgressDialog crash when importing TTF font
This commit is contained in:
Rémi Verschelde 2024-06-14 17:13:21 +02:00
commit 8b271c8315
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 8 additions and 3 deletions

View File

@ -1718,6 +1718,7 @@ void EditorFileSystem::update_file(const String &p_file) {
} }
void EditorFileSystem::update_files(const Vector<String> &p_script_paths) { void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
bool updated = false;
for (const String &file : p_script_paths) { for (const String &file : p_script_paths) {
ERR_CONTINUE(file.is_empty()); ERR_CONTINUE(file.is_empty());
EditorFileSystemDirectory *fs = nullptr; EditorFileSystemDirectory *fs = nullptr;
@ -1747,6 +1748,7 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
memdelete(fs->files[cpos]); memdelete(fs->files[cpos]);
fs->files.remove_at(cpos); fs->files.remove_at(cpos);
updated = true;
} }
} else { } else {
String type = ResourceLoader::get_resource_type(file); String type = ResourceLoader::get_resource_type(file);
@ -1814,12 +1816,15 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
if (fs->files[cpos]->type == SNAME("PackedScene")) { if (fs->files[cpos]->type == SNAME("PackedScene")) {
_queue_update_scene_groups(file); _queue_update_scene_groups(file);
} }
updated = true;
} }
} }
_update_pending_script_classes(); if (updated) {
_update_pending_scene_groups(); _update_pending_script_classes();
call_deferred(SNAME("emit_signal"), "filesystem_changed"); //update later _update_pending_scene_groups();
call_deferred(SNAME("emit_signal"), "filesystem_changed"); //update later
}
} }
HashSet<String> EditorFileSystem::get_valid_extensions() const { HashSet<String> EditorFileSystem::get_valid_extensions() const {