diff options
author | Patrick Benavoli <patrick.benavoli@intel.com> | 2014-07-03 22:30:44 +0200 |
---|---|---|
committer | Philippe Afonso <philippex.afonso@intel.com> | 2015-02-18 11:13:26 +0100 |
commit | 79694d5d0a632ed4ca04ea42f19fb09c3fba0cdb (patch) | |
tree | 11ad0993e9e4ac9f215f3aacba0857c801f8c1c0 /parameter | |
parent | 822d0a70b3a2a4f862d01fa6c0194a406708bf63 (diff) | |
download | external_parameter-framework-79694d5d0a632ed4ca04ea42f19fb09c3fba0cdb.zip external_parameter-framework-79694d5d0a632ed4ca04ea42f19fb09c3fba0cdb.tar.gz external_parameter-framework-79694d5d0a632ed4ca04ea42f19fb09c3fba0cdb.tar.bz2 |
Delete subsystem instances *before* plugin unload
BZ: 208504
Before this patch there was a crash in CElement destructor in Ubuntu upon
destuction of parameter framework instance.
The crash was caused by the attempt to call unmapped code: The subsystem
plugin libraries were getting unloaded before the execution of the subsystem
destructors.
Note:
In Android the issue is not seen since library unload is not implemented.
This patch ensures SystemClass destructor destroys the subsystems explicitely
unloading the plugins.
Change-Id: I19dad262b384bdbd63c7c319a41a5d547d0e75e9
Signed-off-by: Patrick Benavoli <patrick.benavoli@intel.com>
Diffstat (limited to 'parameter')
-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. */ }; |