Explorar el Código

Fixed a crash due to a localized string finalizer being called twice

BearishSun hace 10 años
padre
commit
1fd09a0d22
Se han modificado 3 ficheros con 7 adiciones y 12 borrados
  1. 1 1
      MBansheeEditor/ToolbarItem.cs
  2. 3 11
      SBansheeEditor/Source/BsToolbarItemManager.cpp
  3. 3 0
      TODO.txt

+ 1 - 1
MBansheeEditor/ToolbarItem.cs

@@ -58,7 +58,7 @@ namespace BansheeEditor
         private string name;
         private string icon;
         private int builtinIcon;
-        private LocString tooltip;
+        private string tooltip;
         private int priority;
         private bool separator;
     }

+ 3 - 11
SBansheeEditor/Source/BsToolbarItemManager.cpp

@@ -11,8 +11,6 @@
 #include "BsMainEditorWindow.h"
 #include "BsGUIMenuBar.h"
 #include "BsGUIContent.h"
-#include "BsScriptSpriteTexture.h"
-#include "BsScriptHString.h"
 #include "BsBuiltinEditorResources.h"
 #include "BsProjectLibrary.h"
 
@@ -133,17 +131,11 @@ namespace BansheeEngine
 			icon = static_resource_cast<SpriteTexture>(ProjectLibrary::instance().load(texturePath));
 		}
 
-		MonoObject* tooltipMono;
+		MonoString* tooltipMono;
 		mTooltipField->getValue(toolbarItemAttrib, &tooltipMono);
 
-		if (tooltipMono == nullptr)
-			tooltip = HString::dummy();
-		else
-		{
-			ScriptHString* tooltipScript = ScriptHString::toNative(tooltipMono);
-			tooltip = tooltipScript->getInternalValue();
-		}
-		
+		tooltip = HString(MonoUtil::monoToWString(tooltipMono));
+
 		mPriorityField->getValue(toolbarItemAttrib, &priority);
 		mSeparatorField->getValue(toolbarItemAttrib, &separator);
 

+ 3 - 0
TODO.txt

@@ -165,6 +165,9 @@ parameter solves the problem (presumably boxing the return value would also work
 Sometimes exceptions cause a crash in Event, although this is due to an exception triggering a dialog box which triggers
 the message loop and causes another exception. Make sure to look for the original exception.
 
+Finalizers on attribute members will get called more than once. This causes issues if some of the members reference native 
+objects as already deleted native objects will try to be deleted again. 
+
 ----------------------------------------------------------------------
 MenuItem