Fix crash on emitting a signal during a constructor.
[dcpomatic.git] / src / lib / content.cc
index 499f90dd11d4980b4035a007ae8343b0ba929f35..3b9c3e3a1e55e13503641b4fd6d8c3586f87122f 100644 (file)
@@ -155,8 +155,12 @@ Content::examine (shared_ptr<Job> job)
 void
 Content::signal_changed (int p)
 {
-       changed (p);
-       emit (boost::bind (boost::ref (Changed), shared_from_this (), p, _change_signals_frequent));
+       try {
+               emit (boost::bind (boost::ref (Changed), shared_from_this (), p, _change_signals_frequent));
+               changed (p);
+       } catch (boost::bad_weak_ptr) {
+               /* This must be during construction; never mind */
+       }
 }
 
 void