Explorar o código

Bugfix: Fix a crash when attempting to reimport a file asynchronously, when previous reimport hasn't yet finished

BearishSun %!s(int64=6) %!d(string=hai) anos
pai
achega
d4665e6311

+ 4 - 0
Source/EditorCore/Library/BsProjectLibrary.cpp

@@ -473,6 +473,10 @@ namespace bs
 			{
 				dependency = iterFind->second->importTask;
 
+				// Need this reference just so the dependency is kept alive, otherwise it goes out of scope when we
+				// remove or overwrite it from mQueuedImports map
+				queuedImport->dependsOn = iterFind->second;
+
 				// Note: We should cancel the task here so it doesn't run unnecessarily. But if the task is already
 				// running it shouldn't be canceled as dependencies still need to wait on it (since cancelling a
 				// running task doesn't actually stop it). Yet there is currently no good wait to check if task

+ 1 - 0
Source/EditorCore/Library/BsProjectLibrary.h

@@ -316,6 +316,7 @@ namespace bs
 			SPtr<Task> importTask;
 			SPtr<ImportOptions> importOptions;
 			Vector<QueuedImportResource> resources;
+			SPtr<QueuedImport> dependsOn;
 			bool pruneMetas = false;
 			bool canceled = false;
 			bool native = false;