瀏覽代碼

Fix deadlock in `EditorFileSystem::reimport_files`.

Pāvels Nadtočajevs 2 月之前
父節點
當前提交
507cb47f97
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      editor/editor_file_system.cpp

+ 7 - 5
editor/editor_file_system.cpp

@@ -3248,11 +3248,13 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
 
 					int imported_count = 0;
 					while (true) {
-						ep->step(reimport_files[imported_count].path.get_file(), from + imported_count, false);
-						imported_sem.wait();
-						do {
-							imported_count++;
-						} while (imported_sem.try_wait());
+						while (true) {
+							ep->step(reimport_files[imported_count].path.get_file(), from + imported_count, false);
+							if (imported_sem.try_wait()) {
+								imported_count++;
+								break;
+							}
+						}
 						if (imported_count == item_count) {
 							break;
 						}