Browse Source

Fix possible NULL pointer exceptions and release StringStorage on shutdown.

Lloyd Weehuizen 15 years ago
parent
commit
d73900739f
3 changed files with 4 additions and 2 deletions
  1. 1 1
      Source/Core/Context.cpp
  2. 2 0
      Source/Core/Core.cpp
  3. 1 1
      Source/Core/ElementDocument.cpp

+ 1 - 1
Source/Core/Context.cpp

@@ -56,7 +56,7 @@ Context::Context(const String& name) : name(name), mouse_position(0, 0), dimensi
 	cursor_proxy = dynamic_cast< ElementDocument* >(element);
 	if (cursor_proxy == NULL)
 	{
-		if (element == NULL)
+		if (element != NULL)
 			element->RemoveReference();
 	}
 

+ 2 - 0
Source/Core/Core.cpp

@@ -146,6 +146,8 @@ void Shutdown()
 
 	if (system_interface != NULL)
 		system_interface->RemoveReference();
+		
+	StringStorage::ClearPools();
 }
 
 // Returns the version of this Rocket library.

+ 1 - 1
Source/Core/ElementDocument.cpp

@@ -270,7 +270,7 @@ ElementText* ElementDocument::CreateTextNode(const String& text)
 	if (!element_text)
 	{
 		Log::Message(Log::LT_ERROR, "Failed to create text element, instancer didn't return a derivative of ElementText.");
-		element_text->RemoveReference();
+		element->RemoveReference();
 		return NULL;
 	}