2
0
Marko Pintera 11 жил өмнө
parent
commit
fb93370d4c

+ 1 - 1
BansheeCore/Include/BsResourceHandle.h

@@ -43,7 +43,7 @@ namespace BansheeEngine
 		 * 			
 		 * @note	Careful not to call this on the thread that does the loading.
 		 */
-		void blockUntilLoaded() const;
+		void blockUntilLoaded(bool waitForDependencies = true) const;
 
 		/**
 		 * @brief	Returns the UUID of the resource the handle is referring to.

+ 3 - 3
BansheeCore/Source/BsCoreApplication.cpp

@@ -126,9 +126,6 @@ namespace BansheeEngine
 		ProfilerGPU::shutDown();
 
 		CoreSceneManager::shutDown();
-
-		RendererManager::shutDown();
-		shutdownPlugin(mRendererPlugin);
 		
 		Input::shutDown();
 
@@ -137,6 +134,9 @@ namespace BansheeEngine
 		GameObjectManager::shutDown();
 		RenderStateManager::shutDown();
 
+		RendererManager::shutDown();
+		shutdownPlugin(mRendererPlugin);
+
 		// All CoreObject related modules should be shut down now. They have likely queued CoreObjects for destruction, so
 		// we need to wait for those objects to get destroyed before continuing.
 		gCoreThread().update();

+ 3 - 3
BansheeCore/Source/BsResourceHandle.cpp

@@ -30,15 +30,15 @@ namespace BansheeEngine
 		return isLoaded;
 	}
 
-	void ResourceHandleBase::blockUntilLoaded() const
+	void ResourceHandleBase::blockUntilLoaded(bool waitForDependencies) const
 	{
 		if(mData == nullptr)
 			return;
 
-		if(!mData->mIsCreated)
+		if (!isLoaded(waitForDependencies))
 		{
 			BS_LOCK_MUTEX_NAMED(mResourceCreatedMutex, lock);
-			while(!mData->mIsCreated)
+			while (!mData->mIsCreated || (waitForDependencies && !mData->mPtr->areDependenciesLoaded()))
 			{
 				BS_THREAD_WAIT(mResourceCreatedCondition, mResourceCreatedMutex, lock);
 			}

+ 2 - 2
BansheeCore/Source/BsResources.cpp

@@ -209,8 +209,8 @@ namespace BansheeEngine
 
 		if (!resource.isLoaded()) // If it's still loading wait until that finishes
 		{
-			LOGWRN("Performance warning: Unloading a resource that is still in process of loading \
-				   causes a stall until resource finishes loading.");
+			LOGWRN("Performance warning: Unloading a resource that is still in process of loading "
+				   "causes a stall until resource finishes loading.");
 			resource.blockUntilLoaded();
 		}
 

+ 1 - 4
TODO.txt

@@ -2,10 +2,7 @@
 
 See GDrive/Resources doc for resources refactor
 
-There seems to be some kind of memory corruption that happens when cloning game objects. During one clone the field entries provided to
-ManagedSerializeArray::deserializeManagedInstance were reported as ManagedSerializedArray instead of ManagerSerializedFieldData types.
-It's inconsistent to reproduce but started happening after I have modified managed object serialization to be on-demand. It's possibly
-related to lambdas not capturing types as I expect them to. It always happens in the same place.
+Shutting down causes an exception as Technique tries to access RendererManager on unload
 
 I can get mono errors by checking g_print calls in goutput.c
  - Calling thunks incorrectly can cause those weird errors with no real callstack