From 75c3b147f1f68673054bfb470f48e89fbe90d8c8 Mon Sep 17 00:00:00 2001 From: Sampo Savolainen Date: Sun, 12 Nov 2006 22:50:21 +0000 Subject: [PATCH] Make sure ControlProtocolInfo objects are also cleaned up when disconnecting from a session. git-svn-id: svn://localhost/ardour2/trunk@1118 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/control_protocol_manager.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index 1ff6c28ef3..a715254747 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -36,6 +36,13 @@ ControlProtocolManager::~ControlProtocolManager() } control_protocols.clear (); + + + for (list::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) { + delete (*p); + } + + control_protocol_info.clear(); } @@ -68,6 +75,12 @@ ControlProtocolManager::drop_session () delete *p; } control_protocols.clear (); + + for (list::iterator p = control_protocol_info.begin(); p != control_protocol_info.end(); ++p) { + delete *p; + } + + control_protocol_info.clear(); } } @@ -122,6 +135,15 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi) list::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol); if (p != control_protocols.end()) { control_protocols.erase (p); + } else { + cerr << "Programming error: ControlProtocolManager::teardown() called for " << cpi.name << ", but it was not found in control_protocols" << endl; + } + + list::iterator p2 = find (control_protocol_info.begin(), control_protocol_info.end(), &cpi); + if (p2 != control_protocol_info.end()) { + control_protocol_info.erase (p2); + } else { + cerr << "Programming error: ControlProtocolManager::teardown() called for " << cpi.name << ", but it was not found in control_protocol_info" << endl; } }