13
0

possible extra housekeeping for control protocol modules.

Currently this code isn't reached because we never call ControlProtocolManager::teardown() on inactive protocols. But at some point it might be appropriate to unload modules (.so/.dll/.dylib) even if the protocol was never instantiated
This commit is contained in:
Paul Davis 2015-12-30 04:11:14 -05:00
parent 2c6d92ec96
commit b390d8c8a6

View File

@ -193,6 +193,18 @@ int
ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
{
if (!cpi.protocol) {
/* we could still have a descriptor even if the protocol was
never instantiated. Close the associated module (shared
object/DLL) and make sure we forget about it.
*/
if (cpi.descriptor) {
cerr << "Closing descriptor for CPI anyway\n";
delete (Glib::Module*) cpi.descriptor->module;
cpi.descriptor = 0;
}
return 0;
}
@ -226,7 +238,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
delete cpi.state;
cpi.state = 0;
cerr << "Tear down CPI module for " << cpi.name << endl;
delete (Glib::Module*) cpi.descriptor->module;
/* cpi->descriptor is now inaccessible since dlclose() or equivalent
* has been performed, and the descriptor is (or could be) a static