diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc index 67268c1db2..9572bade6e 100644 --- a/libs/pbd/controllable.cc +++ b/libs/pbd/controllable.cc @@ -29,7 +29,6 @@ using namespace PBD; using namespace std; -PBD::Signal1 Controllable::Destroyed; PBD::Signal1 > Controllable::StartLearning; PBD::Signal1 > Controllable::StopLearning; PBD::Signal1 > Controllable::GUIFocusChanged; @@ -104,6 +103,7 @@ Controllable::add (Controllable& ctl) Glib::Threads::RWLock::WriterLock lm (registry_lock); registry.insert (&ctl); ctl.DropReferences.connect_same_thread (registry_connections, boost::bind (&Controllable::remove, &ctl)); + ctl.Destroyed.connect_same_thread (registry_connections, boost::bind (&Controllable::remove, &ctl)); } void @@ -128,3 +128,15 @@ Controllable::by_id (const ID& id) } return boost::shared_ptr(); } + +void +Controllable::dump_registry () +{ + Glib::Threads::RWLock::ReaderLock lm (registry_lock); + unsigned int cnt = 0; + cout << "-- List Of Registered Controllables\n"; + for (Controllables::iterator i = registry.begin(); i != registry.end(); ++i, ++cnt) { + cout << "CTRL: " << (*i)->name() << "\n"; + } + cout << "Total number of registered sontrollables: " << cnt << "\n"; +} diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 6eeb9956da..92743c4f66 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -22,7 +22,6 @@ #include #include -#include #include "pbd/libpbd_visibility.h" #include "pbd/signals.h" @@ -62,7 +61,6 @@ public: }; Controllable (const std::string& name, Flag f = Flag (0)); - virtual ~Controllable() { Destroyed (this); } /* We express Controllable values in one of three ways: * 1. `user' --- as presented to the user (e.g. dB, Hz, etc.) @@ -129,8 +127,6 @@ public: static PBD::Signal1 > StartLearning; static PBD::Signal1 > StopLearning; - static PBD::Signal1 Destroyed; - static PBD::Signal1 > GUIFocusChanged; PBD::Signal2 Changed; @@ -138,7 +134,7 @@ public: int set_state (const XMLNode&, int version); virtual XMLNode& get_state (); - std::string name() const { return _name; } + std::string name() const { return _name; } bool touching () const { return _touching; } PBD::Signal0 TouchChanged; @@ -154,6 +150,7 @@ public: void set_flags (Flag f); static boost::shared_ptr by_id (const PBD::ID&); + static void dump_registry (); static const std::string xml_node_name; @@ -178,7 +175,6 @@ private: static void add (Controllable&); static void remove (Controllable*); - }; /* a utility class for the occasions when you need but do not have