bind() call involving shared_ptr<Crossfade> fixed
[ardour.git] / gtk2_ardour / audio_streamview.cc
index 14036bc569c3603e23f537a95491ae2cb6239bdd..279130ad381ee919573249401c945e751f199293 100644 (file)
@@ -290,13 +290,27 @@ AudioStreamView::playlist_changed (boost::shared_ptr<Diskstream> ds)
                playlist_connections.push_back (apl->NewCrossfade.connect (mem_fun (*this, &AudioStreamView::add_crossfade)));
 }
 
+void
+AudioStreamView::add_crossfade_weak (boost::weak_ptr<Crossfade> crossfade)
+{
+       boost::shared_ptr<Crossfade> sp (crossfade.lock());
+
+       if (!sp) {
+               return;
+       }
+
+       add_crossfade (sp);
+}
+
 void
 AudioStreamView::add_crossfade (boost::shared_ptr<Crossfade> crossfade)
 {
        AudioRegionView* lview = 0;
        AudioRegionView* rview = 0;
+
+       /* we do not allow shared_ptr<T> to be bound to slots */
        
-       ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_crossfade), crossfade));
+       ENSURE_GUI_THREAD (bind (mem_fun (*this, &AudioStreamView::add_crossfade_weak), boost::weak_ptr<Crossfade> (crossfade)));
 
        /* first see if we already have a CrossfadeView for this Crossfade */