Skip to content

Commit ea061c1

Browse files
jmirabelolivier-stasse
authored andcommitted
Calls destroySotExternalInterface on clean up
1 parent 0088984 commit ea061c1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/sot_loader_basic.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,25 @@ void SotLoaderBasic::Initialization()
214214
void SotLoaderBasic::CleanUp()
215215
{
216216
dynamicgraph::PoolStorage::destroy();
217+
// We do not destroy the FactoryStorage singleton because the module will not
218+
// be reloaded at next initialization (because Python C API cannot safely
219+
// unload a module...).
220+
// SignalCaster singleton could probably be destroyed.
221+
222+
// Load the symbols.
223+
destroySotExternalInterface_t * destroySot =
224+
reinterpret_cast<destroySotExternalInterface_t *>
225+
(reinterpret_cast<long>
226+
(dlsym(sotRobotControllerLibrary_,
227+
"destroySotExternalInterface")));
228+
const char* dlsym_error = dlerror();
229+
if (dlsym_error) {
230+
std::cerr << "Cannot load symbol destroy: " << dlsym_error << '\n';
231+
return ;
232+
}
233+
234+
destroySot (sotController_);
235+
sotController_ = NULL;
217236

218237
/// Uncount the number of access to this library.
219238
dlclose(sotRobotControllerLibrary_);

0 commit comments

Comments
 (0)