Fix crash when signalling VideoContent during the constructor (hence indirectly causi...
authorCarl Hetherington <cth@carlh.net>
Sat, 25 Oct 2014 22:52:42 +0000 (23:52 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 25 Oct 2014 22:52:42 +0000 (23:52 +0100)
src/lib/video_content.cc
src/lib/video_content.h

index 976bc3aa02429736d66fc2b4a235943f8a2a408b..98c3d929af4f85e4e6f0c4e4cbc4e7b4f9ea1315 100644 (file)
@@ -65,7 +65,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f)
        , _video_frame_type (VIDEO_FRAME_TYPE_2D)
        , _scale (Config::instance()->default_scale ())
 {
-       set_default_colour_conversion ();
+       set_default_colour_conversion (false);
 }
 
 VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, ContentTime len)
@@ -75,7 +75,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, ContentTime len
        , _video_frame_type (VIDEO_FRAME_TYPE_2D)
        , _scale (Config::instance()->default_scale ())
 {
-       set_default_colour_conversion ();
+       set_default_colour_conversion (false);
 }
 
 VideoContent::VideoContent (shared_ptr<const Film> f, boost::filesystem::path p)
@@ -85,7 +85,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, boost::filesystem::path p)
        , _video_frame_type (VIDEO_FRAME_TYPE_2D)
        , _scale (Config::instance()->default_scale ())
 {
-       set_default_colour_conversion ();
+       set_default_colour_conversion (false);
 }
 
 VideoContent::VideoContent (shared_ptr<const Film> f, cxml::ConstNodePtr node, int version)
@@ -197,9 +197,16 @@ VideoContent::as_xml (xmlpp::Node* node) const
 }
 
 void
-VideoContent::set_default_colour_conversion ()
+VideoContent::set_default_colour_conversion (bool signal)
 {
-       set_colour_conversion (PresetColourConversion (_("sRGB"), 2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6).conversion);
+       {
+               boost::mutex::scoped_lock lm (_mutex);
+               _colour_conversion = PresetColourConversion (_("sRGB"), 2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6).conversion;
+       }
+
+       if (signal) {
+               signal_changed (VideoContentProperty::COLOUR_CONVERSION);
+       }
 }
 
 void
index 3c8e5fefd5a587d7d57ef8f885031197f461e977..b5936d16d356c07249f0f3d6a5aa167900e7211a 100644 (file)
@@ -91,7 +91,7 @@ public:
        void set_scale (VideoContentScale);
        void unset_colour_conversion ();
        void set_colour_conversion (ColourConversion);
-       void set_default_colour_conversion ();
+       void set_default_colour_conversion (bool signal = true);
 
        void set_fade_in (ContentTime);
        void set_fade_out (ContentTime);