From: Carl Hetherington Date: Sun, 8 Sep 2019 23:27:23 +0000 (+0100) Subject: Handle errors a little better when scanning for closed captions (in hints). X-Git-Tag: v2.15.19~2 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=6ca34bc1ef59dd206379f35eb940e607a59c9804 Handle errors a little better when scanning for closed captions (in hints). --- diff --git a/src/lib/hints.cc b/src/lib/hints.cc index cf14f0699..a9b9d6f54 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -273,20 +273,24 @@ Hints::thread () struct timeval last_pulse; gettimeofday (&last_pulse, 0); - while (!player->pass()) { - - struct timeval now; - gettimeofday (&now, 0); - if ((seconds(now) - seconds(last_pulse)) > 1) { - { - boost::mutex::scoped_lock lm (_mutex); - if (_stop) { - break; + try { + while (!player->pass()) { + + struct timeval now; + gettimeofday (&now, 0); + if ((seconds(now) - seconds(last_pulse)) > 1) { + { + boost::mutex::scoped_lock lm (_mutex); + if (_stop) { + break; + } } + emit (bind (boost::ref(Pulse))); + last_pulse = now; } - emit (bind (boost::ref(Pulse))); - last_pulse = now; } + } catch (...) { + store_current (); } emit (bind(boost::ref(Finished))); diff --git a/src/lib/hints.h b/src/lib/hints.h index 00c2486e7..e9a75fb14 100644 --- a/src/lib/hints.h +++ b/src/lib/hints.h @@ -30,7 +30,7 @@ class Film; -class Hints : public Signaller +class Hints : public Signaller, public ExceptionStore { public: explicit Hints (boost::weak_ptr film); diff --git a/src/wx/hints_dialog.cc b/src/wx/hints_dialog.cc index f8d03626f..cb0de450a 100644 --- a/src/wx/hints_dialog.cc +++ b/src/wx/hints_dialog.cc @@ -163,6 +163,12 @@ HintsDialog::pulse () void HintsDialog::finished () { + try { + _hints->rethrow (); + } catch (std::exception& e) { + error_dialog (this, wxString::Format(_("A problem occurred when looking for hints (%s)"), std_to_wx(e.what()))); + } + _finished = true; update (); _gauge->Hide ();