diff options
author | Robin Gareus <robin@gareus.org> | 2019-12-25 17:59:38 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-12-25 17:59:38 +0100 |
commit | ab58c894d391086dfdb1762408cc6c1fa9b2383e (patch) | |
tree | 6c0835ec9eb40ff5eaec0957a6edb4202b316ac7 /libs/ardour | |
parent | df17e3f041ab8f94fcc730dada2b53b57ac9113d (diff) |
Use weak-ptr for source added/removed signals (1/2)
This might fix a "SessionHandleRef exists across session deletion",
when the shared_ptr was be pushed onto a x-thread pool, and not
invalidated in time before the session was closed.
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session.h | 4 | ||||
-rw-r--r-- | libs/ardour/session.cc | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 9326c9b948..3b15c2d7e2 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1783,8 +1783,8 @@ private: public: /* Emited when a new source is added to the session */ - PBD::Signal1< void, boost::shared_ptr<Source> > SourceAdded; - PBD::Signal1< void, boost::shared_ptr<Source> > SourceRemoved; + PBD::Signal1< void, boost::weak_ptr<Source> > SourceAdded; + PBD::Signal1< void, boost::weak_ptr<Source> > SourceRemoved; typedef std::map<PBD::ID,boost::shared_ptr<Source> > SourceMap; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 499cf73379..5ca8f9207d 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -4277,7 +4277,7 @@ Session::destroy_sources (list<boost::shared_ptr<Source> > const& srcs) (*s)->mark_for_remove (); (*s)->drop_references (); - SourceRemoved(*s); + SourceRemoved (boost::weak_ptr<Source> (*s)); /* EMIT SIGNAL */ } return 0; @@ -4369,7 +4369,7 @@ Session::add_source (boost::shared_ptr<Source> source) source->DropReferences.connect_same_thread (*this, boost::bind (&Session::remove_source, this, boost::weak_ptr<Source> (source))); - SourceAdded(source); + SourceAdded (boost::weak_ptr<Source> (source)); /* EMIT SIGNAL */ } } @@ -4392,7 +4392,7 @@ Session::remove_source (boost::weak_ptr<Source> src) if ((i = sources.find (source->id())) != sources.end()) { sources.erase (i); - SourceRemoved(source); + SourceRemoved (src); /* EMIT SIGNAL */ } } |