Quellcode durchsuchen

Fix crash on exit but not automatically deleting GUI objects that would be otherwise be deleted from native code

Marko Pintera vor 11 Jahren
Ursprung
Commit
1bf66e8e93

+ 3 - 2
BansheeEngine.sln

@@ -1,6 +1,8 @@
 
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
+# Visual Studio 2013
+VisualStudioVersion = 12.0.21005.1
+MinimumVisualStudioVersion = 10.0.40219.1
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamelotCore", "CamelotCore\CamelotCore.vcxproj", "{9B21D41C-516B-43BF-9B10-E99B599C7589}"
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamelotCore", "CamelotCore\CamelotCore.vcxproj", "{9B21D41C-516B-43BF-9B10-E99B599C7589}"
 	ProjectSection(ProjectDependencies) = postProject
 	ProjectSection(ProjectDependencies) = postProject
 		{CC7F9445-71C9-4559-9976-FF0A64DCB582} = {CC7F9445-71C9-4559-9976-FF0A64DCB582}
 		{CC7F9445-71C9-4559-9976-FF0A64DCB582} = {CC7F9445-71C9-4559-9976-FF0A64DCB582}
@@ -22,7 +24,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CamelotGLRenderSystem", "Ca
 EndProject
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1D081E5A-615A-4C06-B2DF-0D8D9390DE02}"
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1D081E5A-615A-4C06-B2DF-0D8D9390DE02}"
 	ProjectSection(SolutionItems) = preProject
 	ProjectSection(SolutionItems) = preProject
-		BoostPort.txt = BoostPort.txt
 		CSharpWrap.txt = CSharpWrap.txt
 		CSharpWrap.txt = CSharpWrap.txt
 		Dependencies.txt = Dependencies.txt
 		Dependencies.txt = Dependencies.txt
 		DrawHelper.txt = DrawHelper.txt
 		DrawHelper.txt = DrawHelper.txt

+ 0 - 10
BoostPort.txt

@@ -1,10 +0,0 @@
- - Ability to construct Module using startUp without having to do allocation outside of it
-
-Create a proper git repo of dependencies folder
-
-Shutdown issues (can't repro atm but they're there):
-Destroying area sometimes fails
- - I'm guessing that is because EditorWindows get closed and destroyed before scripts are unloaded. All areas and GUI elements are destroyed with them.
-  - I should try to manually destroy C# editor windows before main window is closed
-
-Native instance is sometimes null when delete is called

+ 0 - 1
SBansheeEngine/Include/BsScriptGUIArea.h

@@ -26,7 +26,6 @@ namespace BansheeEngine
 		ScriptGUIArea(MonoObject* instance, GUIArea* area, ScriptGUIPanel* panel);
 		ScriptGUIArea(MonoObject* instance, GUIArea* area, ScriptGUIPanel* panel);
 
 
 		void destroy();
 		void destroy();
-		void _onManagedInstanceDeleted();
 
 
 		GUIArea* mGUIArea;
 		GUIArea* mGUIArea;
 		RectI mArea;
 		RectI mArea;

+ 4 - 1
SBansheeEngine/Include/BsScriptGUIElement.h

@@ -38,7 +38,10 @@ namespace BansheeEngine
 
 
 		void _onManagedInstanceDeleted()
 		void _onManagedInstanceDeleted()
 		{
 		{
-			destroy();
+			// Elements with a GUIWidget parent are destroyed automatically when widget is destroyed, but those without one
+			// we need to destroy manually.
+			if (getGUIElement()->_getParentWidget() == nullptr) 
+				destroy();
 
 
 			ScriptObject::_onManagedInstanceDeleted();
 			ScriptObject::_onManagedInstanceDeleted();
 		}
 		}

+ 1 - 7
SBansheeEngine/Source/BsScriptGUIArea.cpp

@@ -15,6 +15,7 @@ namespace BansheeEngine
 	{
 	{
 		mParentPanel->registerArea(this);
 		mParentPanel->registerArea(this);
 	}
 	}
+
 	void ScriptGUIArea::initRuntimeData()
 	void ScriptGUIArea::initRuntimeData()
 	{
 	{
 		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIArea::internal_createInstance);
 		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIArea::internal_createInstance);
@@ -36,13 +37,6 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
-	void ScriptGUIArea::_onManagedInstanceDeleted()
-	{
-		destroy();
-
-		ScriptObject::_onManagedInstanceDeleted();
-	}
-
 	void ScriptGUIArea::internal_createInstance(MonoObject* instance, MonoObject* panel, INT32 x, INT32 y, UINT32 width, UINT32 height, UINT16 depth)
 	void ScriptGUIArea::internal_createInstance(MonoObject* instance, MonoObject* panel, INT32 x, INT32 y, UINT32 width, UINT32 height, UINT16 depth)
 	{
 	{
 		ScriptGUIPanel* scriptGUIPanel = ScriptGUIPanel::toNative(panel);
 		ScriptGUIPanel* scriptGUIPanel = ScriptGUIPanel::toNative(panel);