X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fjob.cc;h=35f5834080af4ab9de1f876a52656961631532c9;hb=d2728b07a42b0da60effd259b508761e670c0789;hp=c228defc541737542c67b5f08045a428b16d849c;hpb=79af506328e80ad84cbe0dddaf2e1a21d4df1fe8;p=dcpomatic.git diff --git a/src/lib/job.cc b/src/lib/job.cc index c228defc5..35f583408 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -42,8 +42,9 @@ using boost::shared_ptr; using boost::optional; using boost::function; -#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_ERROR); +#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_ERROR); +/** @param film Associated film, or 0 */ Job::Job (shared_ptr film) : _film (film) , _thread (0) @@ -59,6 +60,7 @@ Job::~Job () { if (_thread) { _thread->interrupt (); + DCPOMATIC_ASSERT (_thread->joinable ()); _thread->join (); } @@ -320,10 +322,12 @@ Job::error_summary () const void Job::set_error (string s, string d) { - LOG_ERROR_NC (s); - LOG_ERROR_NC (d); + if (_film) { + LOG_ERROR_NC (s); + LOG_ERROR_NC (d); + _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), LogEntry::TYPE_ERROR); + } - _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), Log::TYPE_ERROR); boost::mutex::scoped_lock lm (_state_mutex); _error_summary = s; _error_details = d; @@ -416,7 +420,10 @@ Job::cancel () } _thread->interrupt (); + DCPOMATIC_ASSERT (_thread->joinable ()); _thread->join (); + delete _thread; + _thread = 0; } void @@ -447,4 +454,3 @@ Job::when_finished (boost::signals2::connection& connection, function fi connection = Finished.connect (finished); } } -