Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 2, 2016, 4:06:30 PM (8 years ago)
Author:
landauf
Message:

Added config value to PluginManager to define whether a dereferenced plugin should be completely unloaded (i.e. the shared library is closed) or merely deactivated (i.e. the library remains in the process, but Identifiers and other framework components are removed).
This option is true by default on tardis machines because there it seems impossible to completely unload a shared library due to the use of STB_GNU_UNIQUE which prevents that dlclose() unloads the library. This caused errors when a plugin should have been reloaded, e.g. when the pong level was restarted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/module/PluginManager.cc

    r11015 r11016  
    3434#include "Plugin.h"
    3535#include "PluginReference.h"
     36#include "core/CoreIncludes.h"
    3637#include "core/ApplicationPaths.h"
    3738#include "core/command/ConsoleCommandIncludes.h"
     39#include "core/config/ConfigValueIncludes.h"
    3840#include "core/object/Context.h"
     41
     42#ifdef DO_NOT_UNLOAD_PLUGINS
     43#  define MERELY_DEACTIVATE_PLUGINS true
     44#else
     45#  define MERELY_DEACTIVATE_PLUGINS false
     46#endif
    3947
    4048namespace orxonox
     
    4856    PluginManager* PluginManager::singletonPtr_s  = 0;
    4957
     58    RegisterAbstractClass(PluginManager).inheritsFrom<Configurable>();
     59
    5060    PluginManager::PluginManager()
    5161    {
     62        RegisterObject(PluginManager);
     63
    5264        ModifyConsoleCommand("PluginManager", __CC_PluginManager_load_name).setObject(this);
    5365        ModifyConsoleCommand("PluginManager", __CC_PluginManager_unload_name).setObject(this);
     66
     67        this->setConfigValues();
    5468    }
    5569
     
    6377        for (std::map<std::string, Plugin*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)
    6478            delete it->second;
     79    }
     80
     81    void PluginManager::setConfigValues()
     82    {
     83        SetConfigValue(bMerelyDeactivatePlugins_, MERELY_DEACTIVATE_PLUGINS);
    6584    }
    6685
     
    99118        Plugin* plugin = this->plugins_[name];
    100119        if (plugin != NULL)
    101             plugin->dereference(false);
     120            plugin->dereference(this->bMerelyDeactivatePlugins_);
    102121        else
    103122            orxout(internal_warning) << "Cannot find plugin with name " << name << endl;
Note: See TracChangeset for help on using the changeset viewer.