summaryrefslogtreecommitdiff
path: root/libs/ardour/control_protocol_manager.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-12-30 04:11:14 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2015-12-30 04:11:14 -0500
commitb390d8c8a67c0b48a7e31f47c90b4d23f7fa5fc4 (patch)
tree4bb2084d768c1af2ae7a7173d09547ade95ab242 /libs/ardour/control_protocol_manager.cc
parent2c6d92ec960a7dd70889389e58f6ee84a1e9b0a9 (diff)
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
Diffstat (limited to 'libs/ardour/control_protocol_manager.cc')
-rw-r--r--libs/ardour/control_protocol_manager.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc
index 3856743e70..c042e4f0c0 100644
--- a/libs/ardour/control_protocol_manager.cc
+++ b/libs/ardour/control_protocol_manager.cc
@@ -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