Fix hang on session going away when there is nothing to process. Fixes #3284.
[ardour.git] / libs / ardour / export_formats.cc
index a7dd544d47391f4e63dede355a3ec7f9b37e6114..ef6bbe35bc614fc8fcd3ccd664baac522046a8e1 100644 (file)
@@ -59,10 +59,12 @@ HasSampleFormat::add_sample_format (ExportFormatBase::SampleFormat format)
 
        SampleFormatPtr ptr (new SampleFormatState (format, get_sample_format_name (format)));
        sample_format_states.push_back (ptr);
-       ptr->SelectChanged.connect (*this, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1));
-       // BOOST SIGNALS how to connect one signal to another
-       // ptr->SelectChanged.connect (*this, boost::bind (SampleFormatSelectChanged, _1, WeakSampleFormatPtr (ptr));
-       // ptr->CompatibleChanged.connect (*this, boost::bind (SampleFormatCompatibleChanged, _1, WeakSampleFormatPtr (ptr));
+       ptr->SelectChanged.connect_same_thread (*this, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1));
+       // BOOST SIGNALS Could this be made any uglier?
+       ptr->SelectChanged.connect_same_thread (*this,
+               boost::bind (boost::type<void> (), boost::ref (SampleFormatSelectChanged), _1, WeakSampleFormatPtr (ptr)));
+       ptr->CompatibleChanged.connect_same_thread (*this,
+               boost::bind (boost::type<void> (), boost::ref (SampleFormatCompatibleChanged), _1, WeakSampleFormatPtr (ptr)));
 }
 
 void
@@ -70,10 +72,12 @@ HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, Glib::ustri
 {
        DitherTypePtr ptr (new DitherTypeState (type, name));
        dither_type_states.push_back (ptr);
-       ptr->SelectChanged.connect (*this, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1));
-       // BOOST SIGNALS how to connect one signal to another
-       // ptr->SelectChanged.connect (*this, boost::bind (DitherTypeSelectChanged, _1, WeakDitherTypePtr (ptr));
-       // ptr->CompatibleChanged.connect (*this, boost::bind (DitherTypeCompatibleChanged, _1, WeakDitherTypePtr (ptr));
+       ptr->SelectChanged.connect_same_thread (*this, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1));
+       // BOOST SIGNALS Could this be made any uglier?
+       ptr->SelectChanged.connect_same_thread (*this,
+               boost::bind (boost::type<void> (), boost::ref (DitherTypeSelectChanged), _1, WeakDitherTypePtr (ptr)));
+       ptr->CompatibleChanged.connect_same_thread (*this,
+               boost::bind (boost::type<void> (),boost::ref ( DitherTypeCompatibleChanged), _1, WeakDitherTypePtr (ptr)));
 }
 
 HasSampleFormat::SampleFormatPtr