diff options
author | Robin Gareus <robin@gareus.org> | 2019-03-23 14:28:12 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-03-23 14:31:00 +0100 |
commit | ff8bd935cf27a833f5611d2123230893a9862c4f (patch) | |
tree | 18127ff77aa7ca0566c6bcac2e7cf22ad2bdc71e /libs/ardour/session_state.cc | |
parent | 73029d45baf97da6b0a2c8ec9688c33da69fff8d (diff) |
Remove chicken/egg d'tor
Session::Controllables is a shared_ptr<> list. As long
as the session exists the Controllables will be around. Destroyed(*)
can only be called after the session is destroyed and releases the
shared_ptr<>
NB. this code had a nice hack to construct a "shared_from_this"
workaround. For future reference:
struct null_deleter { void operator()(void const *) const {} };
boost::shared_ptr<Controllable>(c, null_deleter())
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 6e791b4d8a..9ed5a27269 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -208,7 +208,6 @@ Session::pre_engine_init (string fullpath) SourceFactory::SourceCreated.connect_same_thread (*this, boost::bind (&Session::add_source, this, _1)); PlaylistFactory::PlaylistCreated.connect_same_thread (*this, boost::bind (&Session::add_playlist, this, _1, _2)); AutomationList::AutomationListCreated.connect_same_thread (*this, boost::bind (&Session::add_automation_list, this, _1)); - Controllable::Destroyed.connect_same_thread (*this, boost::bind (&Session::remove_controllable, this, _1)); IO::PortCountChanged.connect_same_thread (*this, boost::bind (&Session::ensure_buffers, this, _1)); /* stop IO objects from doing stuff until we're ready for them */ @@ -3739,24 +3738,6 @@ Session::add_controllable (boost::shared_ptr<Controllable> c) controllables.insert (c); } -struct null_deleter { void operator()(void const *) const {} }; - -void -Session::remove_controllable (Controllable* c) -{ - if (deletion_in_progress()) { - return; - } - - Glib::Threads::Mutex::Lock lm (controllables_lock); - - Controllables::iterator x = controllables.find (boost::shared_ptr<Controllable>(c, null_deleter())); - - if (x != controllables.end()) { - controllables.erase (x); - } -} - boost::shared_ptr<Controllable> Session::controllable_by_id (const PBD::ID& id) { |