Add some missing locks.
authorCarl Hetherington <cth@carlh.net>
Sat, 28 Oct 2023 21:02:40 +0000 (23:02 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 28 Oct 2023 21:02:40 +0000 (23:02 +0200)
src/lib/dcp_content.cc

index 70eb8425ef9f2d572b5e686427428a6e0efdda5b..2d441353a061c996b52970bad9895555e5be0d78 100644 (file)
@@ -461,6 +461,8 @@ DCPContent::identifier () const
                s += i->identifier () + " ";
        }
 
+       boost::mutex::scoped_lock lm(_mutex);
+
        s += string (_reference_video ? "1" : "0");
        for (auto text: _reference_text) {
                s += string(text ? "1" : "0");
@@ -804,6 +806,13 @@ DCPContent::take_settings_from (shared_ptr<const Content> c)
                return;
        }
 
+       if (this == dc.get()) {
+               return;
+       }
+
+       boost::mutex::scoped_lock lm(_mutex);
+       boost::mutex::scoped_lock lm2(dc->_mutex);
+
        _reference_video = dc->_reference_video;
        _reference_audio = dc->_reference_audio;
        _reference_text = dc->_reference_text;