diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-10-17 22:23:12 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-10-17 22:23:12 +0200 |
| commit | b33881c9ebe55084434bfea16ba050ad1ba6cb03 (patch) | |
| tree | 326e6b53969af54cf6be4ea5bbf770e2574ac2bf | |
| parent | 1436de822ff18b0f3a6dafbea1e212ac068cc0fd (diff) | |
Fix deadlock when changing CPL in the player (#1827).
TextContent::set_dcp_track can end up requesting a view update, which
involves calls to methods in Content which lock the Content::_mutex.
Do these calls without a lock on that mutex held.
Also, it looks like we would append to texts on every call to
examine(). Fix that so that we replace the texts list on each
examine() call.
| -rw-r--r-- | src/lib/dcp_content.cc | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc index 0bef73f77..f50778420 100644 --- a/src/lib/dcp_content.cc +++ b/src/lib/dcp_content.cc @@ -202,7 +202,6 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) bool const needed_assets = needs_assets (); bool const needed_kdm = needs_kdm (); string const old_name = name (); - int const old_texts = text.size (); ChangeSignaller<Content> cc_texts (this, DCPContentProperty::TEXTS); ChangeSignaller<Content> cc_assets (this, DCPContentProperty::NEEDS_ASSETS); @@ -249,20 +248,21 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) atmos->set_length (examiner->atmos_length()); } - int texts = 0; + list<shared_ptr<TextContent> > new_text; + for (int i = 0; i < TEXT_COUNT; ++i) { + for (int j = 0; j < examiner->text_count(static_cast<TextType>(i)); ++j) { + shared_ptr<TextContent> c(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i))); + if (i == TEXT_CLOSED_CAPTION) { + c->set_dcp_track (examiner->dcp_text_track(j)); + } + new_text.push_back (c); + } + } + { boost::mutex::scoped_lock lm (_mutex); + text = new_text; _name = examiner->name (); - for (int i = 0; i < TEXT_COUNT; ++i) { - for (int j = 0; j < examiner->text_count(static_cast<TextType>(i)); ++j) { - shared_ptr<TextContent> c(new TextContent(this, static_cast<TextType>(i), static_cast<TextType>(i))); - if (i == TEXT_CLOSED_CAPTION) { - c->set_dcp_track (examiner->dcp_text_track(j)); - } - text.push_back (c); - } - } - texts = text.size (); _encrypted = examiner->encrypted (); _needs_assets = examiner->needs_assets (); _kdm_valid = examiner->kdm_valid (); @@ -279,10 +279,6 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job) _content_versions = examiner->content_versions (); } - if (old_texts == texts) { - cc_texts.abort (); - } - if (needed_assets == needs_assets()) { cc_assets.abort (); } |
