Fix crash on emitting a signal during a constructor.
[dcpomatic.git] / src / lib / content.cc
index 724cabb6c6ce28f4bf1d5057e08dc062ab07b525..3b9c3e3a1e55e13503641b4fd6d8c3586f87122f 100644 (file)
@@ -155,7 +155,12 @@ Content::examine (shared_ptr<Job> job)
 void
 Content::signal_changed (int 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
@@ -278,7 +283,7 @@ Content::path_summary () const
 }
 
 /** @return a list of properties that might be interesting to the user */
-list<Content::UserProperty>
+list<UserProperty>
 Content::user_properties () const
 {
        list<UserProperty> p;