Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 6, 2015, 10:43:12 AM (10 years ago)
Author:
landauf
Message:

unload modules, unload and destroy all statically initialized instances

Location:
code/branches/core7/src/libraries/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core7/src/libraries/core/Core.cc

    r10525 r10527  
    128128        // TODO: initialize CommandLineParser here
    129129        // TODO: initialize ConsoleCommandManager here
     130        // TODO: initialize NetworkFunctionManager here
    130131        this->rootModule_ = ModuleInstance::getCurrentModuleInstance();
    131132        this->rootModule_->loadAllStaticallyInitializedInstances();
     
    241242        safeObjectDelete(&languageInstance_);
    242243        safeObjectDelete(&configFileManager_);
     244        safeObjectDelete(&signalHandler_);
     245        Context::getRootContext()->unregisterObject(); // unregister context from object lists - otherwise the root context would be destroyed while unloading the root module
     246        if (this->rootModule_)
     247        {
     248            this->rootModule_->unloadAllStaticallyInitializedInstances();
     249            this->rootModule_->deleteAllStaticallyInitializedInstances();
     250        }
    243251        Context::setRootContext(NULL);
    244         safeObjectDelete(&signalHandler_);
    245 //        if (this->rootModule_)
    246 //            this->rootModule_->unloadAllStaticallyInitializedInstances();
    247 //        safeObjectDelete(&rootModule_);
     252        safeObjectDelete(&rootModule_);
    248253        safeObjectDelete(&dynLibManager_);
    249254        safeObjectDelete(&configurablePaths_);
     
    277282    void Core::loadModule(ModuleInstance* module)
    278283    {
     284        orxout(internal_info) << "Loading module " << module->getName() << "..." << endl;
     285
    279286        ModuleInstance::setCurrentModuleInstance(module);
    280287        DynLib* dynLib = this->dynLibManager_->load(module->getName());
     
    298305    void Core::unloadModule(ModuleInstance* module)
    299306    {
     307        orxout(internal_info) << "Unloading module " << module->getName() << "..." << endl;
     308
    300309        module->unloadAllStaticallyInitializedInstances();
    301310        module->deleteAllStaticallyInitializedInstances();
  • code/branches/core7/src/libraries/core/DynLib.cc

    r10523 r10527  
    6868    {
    6969        // Log library load
    70         orxout(internal_info) << "Loading module " << mName << endl;
     70        orxout(internal_info) << "load DynLib " << mName << endl;
    7171
    7272        std::string name = mName;
     
    101101    {
    102102        // Log library unload
    103         orxout(internal_info) << "Unloading module " << mName << endl;
     103        orxout(internal_info) << "unload DynLib " << mName << endl;
    104104
    105105        if (DYNLIB_UNLOAD( m_hInst ))
  • code/branches/core7/src/libraries/core/Game.cc

    r10524 r10527  
    142142        GameStateFactory::getFactories().clear();
    143143        safeObjectDelete(&config_);
    144 //        if (this->core_)
    145 //            this->core_->unloadModules();
     144        if (this->core_)
     145            this->core_->unloadModules();
    146146        safeObjectDelete(&core_);
    147147        safeObjectDelete(&gameClock_);
Note: See TracChangeset for help on using the changeset viewer.