[Orxonox-commit 5867] r10527 - code/branches/core7/src/libraries/core
landauf at orxonox.net
landauf at orxonox.net
Sat Jun 6 10:43:13 CEST 2015
Author: landauf
Date: 2015-06-06 10:43:12 +0200 (Sat, 06 Jun 2015)
New Revision: 10527
Modified:
code/branches/core7/src/libraries/core/Core.cc
code/branches/core7/src/libraries/core/DynLib.cc
code/branches/core7/src/libraries/core/Game.cc
Log:
unload modules, unload and destroy all statically initialized instances
Modified: code/branches/core7/src/libraries/core/Core.cc
===================================================================
--- code/branches/core7/src/libraries/core/Core.cc 2015-06-06 08:37:40 UTC (rev 10526)
+++ code/branches/core7/src/libraries/core/Core.cc 2015-06-06 08:43:12 UTC (rev 10527)
@@ -127,6 +127,7 @@
// TODO: initialize ScopeManager here
// TODO: initialize CommandLineParser here
// TODO: initialize ConsoleCommandManager here
+ // TODO: initialize NetworkFunctionManager here
this->rootModule_ = ModuleInstance::getCurrentModuleInstance();
this->rootModule_->loadAllStaticallyInitializedInstances();
@@ -240,11 +241,15 @@
safeObjectDelete(&config_);
safeObjectDelete(&languageInstance_);
safeObjectDelete(&configFileManager_);
+ safeObjectDelete(&signalHandler_);
+ Context::getRootContext()->unregisterObject(); // unregister context from object lists - otherwise the root context would be destroyed while unloading the root module
+ if (this->rootModule_)
+ {
+ this->rootModule_->unloadAllStaticallyInitializedInstances();
+ this->rootModule_->deleteAllStaticallyInitializedInstances();
+ }
Context::setRootContext(NULL);
- safeObjectDelete(&signalHandler_);
-// if (this->rootModule_)
-// this->rootModule_->unloadAllStaticallyInitializedInstances();
-// safeObjectDelete(&rootModule_);
+ safeObjectDelete(&rootModule_);
safeObjectDelete(&dynLibManager_);
safeObjectDelete(&configurablePaths_);
safeObjectDelete(&applicationPaths_);
@@ -276,6 +281,8 @@
void Core::loadModule(ModuleInstance* module)
{
+ orxout(internal_info) << "Loading module " << module->getName() << "..." << endl;
+
ModuleInstance::setCurrentModuleInstance(module);
DynLib* dynLib = this->dynLibManager_->load(module->getName());
module->setDynLib(dynLib);
@@ -297,6 +304,8 @@
void Core::unloadModule(ModuleInstance* module)
{
+ orxout(internal_info) << "Unloading module " << module->getName() << "..." << endl;
+
module->unloadAllStaticallyInitializedInstances();
module->deleteAllStaticallyInitializedInstances();
this->dynLibManager_->unload(module->getDynLib());
Modified: code/branches/core7/src/libraries/core/DynLib.cc
===================================================================
--- code/branches/core7/src/libraries/core/DynLib.cc 2015-06-06 08:37:40 UTC (rev 10526)
+++ code/branches/core7/src/libraries/core/DynLib.cc 2015-06-06 08:43:12 UTC (rev 10527)
@@ -67,7 +67,7 @@
void DynLib::load()
{
// Log library load
- orxout(internal_info) << "Loading module " << mName << endl;
+ orxout(internal_info) << "load DynLib " << mName << endl;
std::string name = mName;
#ifdef ORXONOX_PLATFORM_LINUX
@@ -100,7 +100,7 @@
void DynLib::unload()
{
// Log library unload
- orxout(internal_info) << "Unloading module " << mName << endl;
+ orxout(internal_info) << "unload DynLib " << mName << endl;
if (DYNLIB_UNLOAD( m_hInst ))
{
Modified: code/branches/core7/src/libraries/core/Game.cc
===================================================================
--- code/branches/core7/src/libraries/core/Game.cc 2015-06-06 08:37:40 UTC (rev 10526)
+++ code/branches/core7/src/libraries/core/Game.cc 2015-06-06 08:43:12 UTC (rev 10527)
@@ -141,8 +141,8 @@
GameStateFactory::getFactories().clear();
safeObjectDelete(&config_);
-// if (this->core_)
-// this->core_->unloadModules();
+ if (this->core_)
+ this->core_->unloadModules();
safeObjectDelete(&core_);
safeObjectDelete(&gameClock_);
More information about the Orxonox-commit
mailing list