Bläddra i källkod

Fixed a crash on shutdown

BearishSun 9 år sedan
förälder
incheckning
74e59be4b2

+ 3 - 0
Source/BansheeCore/Include/BsTextureManager.h

@@ -112,6 +112,9 @@ namespace BansheeEngine
 		/** @copydoc Module::onStartUp */
 		/** @copydoc Module::onStartUp */
 		void onStartUp() override;
 		void onStartUp() override;
 
 
+		/** @copydoc Module::onShutDown */
+		void onShutDown() override;
+
 		/**
 		/**
 		 * @copydoc	TextureManager::createTexture(TextureType, UINT32, UINT32, UINT32, int, PixelFormat, int, bool, UINT32)
 		 * @copydoc	TextureManager::createTexture(TextureType, UINT32, UINT32, UINT32, int, PixelFormat, int, bool, UINT32)
 		 */
 		 */

+ 8 - 0
Source/BansheeCore/Source/BsTextureManager.cpp

@@ -124,6 +124,14 @@ namespace BansheeEngine
 		TextureCore::NORMAL = normalTexture;
 		TextureCore::NORMAL = normalTexture;
     }
     }
 
 
+	void TextureCoreManager::onShutDown()
+    {
+		// Need to make sure these are freed while still on the core thread
+		TextureCore::WHITE = nullptr;
+		TextureCore::BLACK = nullptr;
+		TextureCore::NORMAL = nullptr;
+    }
+
 	SPtr<TextureCore> TextureCoreManager::createTexture(TextureType texType, UINT32 width, UINT32 height, UINT32 depth,
 	SPtr<TextureCore> TextureCoreManager::createTexture(TextureType texType, UINT32 width, UINT32 height, UINT32 depth,
 		int numMips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 multisampleCount)
 		int numMips, PixelFormat format, int usage, bool hwGammaCorrection, UINT32 multisampleCount)
 	{
 	{