Use weak-ptr for source added/removed signals (2/2)

This commit is contained in:
Robin Gareus 2019-12-25 18:00:57 +01:00
parent ab58c894d3
commit b228dce1c1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 11 additions and 1 deletions

View File

@ -287,7 +287,7 @@ EditorSources::set_session (ARDOUR::Session* s)
ARDOUR::RegionFactory::CheckNewRegion.connect (add_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::add_source, this, _1), gui_context());
s->SourceRemoved.connect (remove_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::remove_source, this, _1), gui_context());
s->SourceRemoved.connect (remove_source_connection, MISSING_INVALIDATOR, boost::bind (&EditorSources::remove_weak_source, this, _1), gui_context());
redisplay();
@ -296,6 +296,15 @@ EditorSources::set_session (ARDOUR::Session* s)
}
}
void
EditorSources::remove_weak_source (boost::weak_ptr<ARDOUR::Source> src)
{
boost::shared_ptr<ARDOUR::Source> source = src.lock();
if (source) {
remove_source (source);
}
}
void
EditorSources::remove_source (boost::shared_ptr<ARDOUR::Source> source)
{

View File

@ -120,6 +120,7 @@ private:
void add_source (boost::shared_ptr<ARDOUR::Region>);
void remove_source (boost::shared_ptr<ARDOUR::Source>);
void remove_weak_source (boost::weak_ptr<ARDOUR::Source>);
void clock_format_changed ();