2
0
Эх сурвалжийг харах

Managed resources are now properly cleaned up on domain finalization
Command queue shutdown no longer cares about the thread

Marko Pintera 11 жил өмнө
parent
commit
098594dddd

+ 1 - 8
BansheeCore/Include/BsCommandQueue.h

@@ -296,14 +296,7 @@ namespace BansheeEngine
 		{ }
 
 		~CommandQueue() 
-		{
-#if BS_DEBUG_MODE
-#if BS_THREAD_SUPPORT != 0
-			if(!isValidThread(getThreadId()))
-				throwInvalidThreadException("Command queue accessed outside of its creation thread.");
-#endif
-#endif
-		}
+		{ }
 
 		/**
 		 * @copydoc CommandQueueBase::queueReturn

+ 1 - 5
Inspector.txt

@@ -3,11 +3,7 @@ Update GUIFoldout with sub styles
 
 Test if drag and dropping scene objects works with object and resource fields. Especially custom resources and components.
 
-Restore widget layout save/load methods
-Fix issue that happens when GUI element is destroyed and tries to access a previously deleted object
-Fix unreleased core objects
-Restore other commented out managed code
-Get InspectorWindow to show up in main window again
+There might be an issue with unreleased TransientMeshes (or MeshHeap) after editor widgets are docked (to test disable layout loading, dock manually and then close)
 
 Test custom resources:
  - Can I load them? (Will likely need ProjectLIbrary::load)

+ 2 - 0
MBansheeEngine/Program.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Runtime.CompilerServices;
 using System.Diagnostics;
 
@@ -143,5 +144,6 @@ namespace BansheeEngine
             else
                 Debug.Log("New value: " + prop2.GetValue<DbgSerzCls>().anotherValue2);
         }
+
     }
 }

+ 2 - 0
SBansheeEngine/Include/BsManagedResource.h

@@ -18,6 +18,8 @@ namespace BansheeEngine
 		static ManagedResourcePtr createEmpty();
 
 	private:
+		friend class ScriptManagedResource;
+
 		ManagedResource(MonoObject* managedInstance);
 		void destroy_internal();
 

+ 8 - 0
SBansheeEngine/Source/BsScriptManagedResource.cpp

@@ -5,6 +5,7 @@
 #include "BsMonoClass.h"
 #include "BsMonoManager.h"
 #include "BsManagedResource.h"
+#include "BsResources.h"
 #include "BsException.h"
 
 namespace BansheeEngine
@@ -30,6 +31,13 @@ namespace BansheeEngine
 	void ScriptManagedResource::_onManagedInstanceDeleted()
 	{
 		mManagedInstance = nullptr;
+		
+		if (mResource != nullptr && mResource.isLoaded())
+		{
+			mResource->mManagedInstance = nullptr;
+			gResources().unload(mResource);
+		}
+
 		ScriptResourceManager::instance().destroyScriptResource(this);
 	}