Index: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc	(revision 10543)
+++ code/branches/core7/src/libraries/core/Core.cc	(revision 10544)
@@ -255,6 +255,5 @@
         if (this->staticInitHandler_)
             StaticInitializationManager::getInstance().removeHandler(this->staticInitHandler_);
-        delete Context::getRootContext();
-        Context::setRootContext(NULL);
+        Context::destroyRootContext();
         safeObjectDelete(&rootModule_);
         safeObjectDelete(&staticInitHandler_);
Index: code/branches/core7/src/libraries/core/object/Context.cc
===================================================================
--- code/branches/core7/src/libraries/core/object/Context.cc	(revision 10543)
+++ code/branches/core7/src/libraries/core/object/Context.cc	(revision 10544)
@@ -79,4 +79,10 @@
     }
 
+    /*static*/ void Context::destroyRootContext()
+    {
+        delete Context::rootContext_s;
+        Context::rootContext_s = NULL;
+    }
+
     /*static*/ Context* Context::getRootContext()
     {
Index: code/branches/core7/src/libraries/core/object/Context.h
===================================================================
--- code/branches/core7/src/libraries/core/object/Context.h	(revision 10543)
+++ code/branches/core7/src/libraries/core/object/Context.h	(revision 10544)
@@ -47,4 +47,5 @@
         public:
             static void setRootContext(Context* context);
+            static void destroyRootContext();
             static Context* getRootContext();
 
Index: code/branches/core7/test/core/class/IdentifiableTest.cc
===================================================================
--- code/branches/core7/test/core/class/IdentifiableTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/IdentifiableTest.cc	(revision 10544)
@@ -22,4 +22,5 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
@@ -28,4 +29,5 @@
                 {
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/IdentifierClassHierarchyTest.cc
===================================================================
--- code/branches/core7/test/core/class/IdentifierClassHierarchyTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/IdentifierClassHierarchyTest.cc	(revision 10544)
@@ -142,5 +142,7 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
@@ -150,5 +152,7 @@
                 {
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/IdentifierExternalClassHierarchyTest.cc
===================================================================
--- code/branches/core7/test/core/class/IdentifierExternalClassHierarchyTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/IdentifierExternalClassHierarchyTest.cc	(revision 10544)
@@ -49,5 +49,7 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
@@ -57,5 +59,7 @@
                 {
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/IdentifierNestedClassHierarchyTest.cc
===================================================================
--- code/branches/core7/test/core/class/IdentifierNestedClassHierarchyTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/IdentifierNestedClassHierarchyTest.cc	(revision 10544)
@@ -109,5 +109,7 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
@@ -117,5 +119,7 @@
                 {
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/IdentifierSimpleClassHierarchyTest.cc
===================================================================
--- code/branches/core7/test/core/class/IdentifierSimpleClassHierarchyTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/IdentifierSimpleClassHierarchyTest.cc	(revision 10544)
@@ -51,5 +51,7 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
@@ -59,5 +61,7 @@
                 {
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/IdentifierTest.cc
===================================================================
--- code/branches/core7/test/core/class/IdentifierTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/IdentifierTest.cc	(revision 10544)
@@ -29,4 +29,5 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
@@ -35,4 +36,5 @@
                 {
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/OrxonoxClassTest.cc
===================================================================
--- code/branches/core7/test/core/class/OrxonoxClassTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/OrxonoxClassTest.cc	(revision 10544)
@@ -1,4 +1,5 @@
 #include <gtest/gtest.h>
 #include "core/class/OrxonoxClass.h"
+#include "core/class/IdentifierManager.h"
 #include "core/object/Context.h"
 
@@ -17,4 +18,5 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     Context::setRootContext(new Context(NULL));
                 }
@@ -22,5 +24,6 @@
                 virtual void TearDown()
                 {
-                    Context::setRootContext(NULL);
+                    Context::destroyRootContext();
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/OrxonoxInterfaceTest.cc
===================================================================
--- code/branches/core7/test/core/class/OrxonoxInterfaceTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/OrxonoxInterfaceTest.cc	(revision 10544)
@@ -2,4 +2,5 @@
 #include "core/class/OrxonoxInterface.h"
 #include "core/class/OrxonoxClass.h"
+#include "core/class/IdentifierManager.h"
 #include "core/object/Context.h"
 
@@ -32,4 +33,5 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     Context::setRootContext(new Context(NULL));
                 }
@@ -37,5 +39,6 @@
                 virtual void TearDown()
                 {
-                    Context::setRootContext(NULL);
+                    Context::destroyRootContext();
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/SubclassIdentifierTest.cc
===================================================================
--- code/branches/core7/test/core/class/SubclassIdentifierTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/SubclassIdentifierTest.cc	(revision 10544)
@@ -31,17 +31,17 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
-
-                    Context::setRootContext(new Context(NULL));
                 }
 
                 virtual void TearDown()
                 {
-                    Context::setRootContext(NULL);
-
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/class/SuperTest.cc
===================================================================
--- code/branches/core7/test/core/class/SuperTest.cc	(revision 10543)
+++ code/branches/core7/test/core/class/SuperTest.cc	(revision 10544)
@@ -72,17 +72,17 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
-
-                    Context::setRootContext(new Context(NULL));
                 }
 
                 virtual void TearDown()
                 {
-                    Context::setRootContext(NULL);
-
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/command/CommandTest.cc
===================================================================
--- code/branches/core7/test/core/command/CommandTest.cc	(revision 10543)
+++ code/branches/core7/test/core/command/CommandTest.cc	(revision 10544)
@@ -140,5 +140,8 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    new ConsoleCommandManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::CONSOLE_COMMAND);
+                    Context::setRootContext(new Context(NULL));
                     Identifier::initConfigValues_s = false; // TODO: hack!
                     IdentifierManager::getInstance().createClassHierarchy();
@@ -148,5 +151,8 @@
                 {
                     IdentifierManager::getInstance().destroyClassHierarchy();
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::CONSOLE_COMMAND);
+                    delete &ConsoleCommandManager::getInstance();
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/object/ClassFactoryTest.cc
===================================================================
--- code/branches/core7/test/core/object/ClassFactoryTest.cc	(revision 10543)
+++ code/branches/core7/test/core/object/ClassFactoryTest.cc	(revision 10544)
@@ -16,12 +16,14 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                     Context::setRootContext(new Context(NULL));
-                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
 
                 virtual void TearDown()
                 {
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
-                    Context::setRootContext(NULL);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/object/ContextTest.cc
===================================================================
--- code/branches/core7/test/core/object/ContextTest.cc	(revision 10543)
+++ code/branches/core7/test/core/object/ContextTest.cc	(revision 10544)
@@ -23,12 +23,14 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                     Context::setRootContext(new Context(NULL));
-                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
 
                 virtual void TearDown()
                 {
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
-                    Context::setRootContext(NULL);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/object/IteratorTest.cc
===================================================================
--- code/branches/core7/test/core/object/IteratorTest.cc	(revision 10543)
+++ code/branches/core7/test/core/object/IteratorTest.cc	(revision 10544)
@@ -34,12 +34,14 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                     Context::setRootContext(new Context(NULL));
-                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
 
                 virtual void TearDown()
                 {
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
-                    Context::setRootContext(NULL);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/object/ListableTest.cc
===================================================================
--- code/branches/core7/test/core/object/ListableTest.cc	(revision 10543)
+++ code/branches/core7/test/core/object/ListableTest.cc	(revision 10544)
@@ -11,5 +11,5 @@
         {
             public:
-            ListableClassTest() { RegisterObject(ListableClassTest); }
+                ListableClassTest() { RegisterObject(ListableClassTest); }
         };
 
@@ -39,12 +39,14 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                     Context::setRootContext(new Context(NULL));
-                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
 
                 virtual void TearDown()
                 {
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
-                    Context::setRootContext(NULL);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/object/ObjectListIteratorTest.cc
===================================================================
--- code/branches/core7/test/core/object/ObjectListIteratorTest.cc	(revision 10543)
+++ code/branches/core7/test/core/object/ObjectListIteratorTest.cc	(revision 10544)
@@ -26,12 +26,14 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                     Context::setRootContext(new Context(NULL));
-                    ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                 }
 
                 virtual void TearDown()
                 {
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
-                    Context::setRootContext(NULL);
+                    delete &IdentifierManager::getInstance();
                 }
         };
Index: code/branches/core7/test/core/singleton/ScopeTest.cc
===================================================================
--- code/branches/core7/test/core/singleton/ScopeTest.cc	(revision 10543)
+++ code/branches/core7/test/core/singleton/ScopeTest.cc	(revision 10544)
@@ -28,12 +28,18 @@
                 virtual void SetUp()
                 {
+                    new IdentifierManager();
+                    new ScopeManager();
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
                     ModuleInstance::getCurrentModuleInstance()->loadAllStaticallyInitializedInstances(StaticInitialization::SCOPED_SINGLETON_WRAPPER);
+                    Context::setRootContext(new Context(NULL));
                 }
 
                 virtual void TearDown()
                 {
+                    Context::destroyRootContext();
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::SCOPED_SINGLETON_WRAPPER);
                     ModuleInstance::getCurrentModuleInstance()->unloadAllStaticallyInitializedInstances(StaticInitialization::IDENTIFIER);
+                    delete &ScopeManager::getInstance();
+                    delete &IdentifierManager::getInstance();
                 }
         };
