diff options
-rw-r--r-- | parameter/SystemClass.cpp | 17 | ||||
-rw-r--r-- | parameter/SystemClass.h | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp index effc573..6169223 100644 --- a/parameter/SystemClass.cpp +++ b/parameter/SystemClass.cpp @@ -71,11 +71,16 @@ CSystemClass::~CSystemClass() { delete _pSubsystemLibrary; - // Close all previously opened libraries - while (!_subsystemLibraries.empty()) - { - dlclose(_subsystemLibraries.back()); - _subsystemLibraries.pop_back(); + // Destroy child subsystems *before* unloading the libraries (otherwise crashes will occur + // as unmapped code will be referenced) + clean(); + + // Close all previously opened subsystem libraries + list<void*>::const_iterator it; + + for (it = _subsystemLibraryHandleList.begin(); it != _subsystemLibraryHandleList.end(); ++it) { + + dlclose(*it); } } @@ -238,7 +243,7 @@ bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, list<string>& lstr } // Store libraries handles - _subsystemLibraries.push_back(lib_handle); + _subsystemLibraryHandleList.push_back(lib_handle); // Get plugin symbol string strPluginSymbol = getPluginSymbol(strPluginFileName); diff --git a/parameter/SystemClass.h b/parameter/SystemClass.h index 3ffbf25..b5bce45 100644 --- a/parameter/SystemClass.h +++ b/parameter/SystemClass.h @@ -111,6 +111,6 @@ private: // Subsystem factory CSubsystemLibrary* _pSubsystemLibrary; - std::list<void*> _subsystemLibraries; /**< Contains the list of all open plugin libs. */ + std::list<void*> _subsystemLibraryHandleList; /**< Contains the list of all open plugin libs. */ }; |