diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-05-30 20:08:39 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-05-30 20:08:39 +0100 |
| commit | 9b98a07cb61fd66fd73f9f58468100ec9b7eddd3 (patch) | |
| tree | bb04cfeae771bf571dc919bca0fdf8d10fb0d560 /src | |
| parent | fd7cf313b4d809bde22b5189e1ab22c5edbd8f8f (diff) | |
Destory TranscodeJob earlier, hopefully to fix #1570.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/job.cc | 7 | ||||
| -rw-r--r-- | src/lib/job.h | 1 | ||||
| -rw-r--r-- | src/lib/transcode_job.cc | 10 | ||||
| -rw-r--r-- | src/lib/transcode_job.h | 3 |
4 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc index 1416ddfc2..43b5fb7e1 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -63,6 +63,12 @@ Job::Job (shared_ptr<const Film> film) Job::~Job () { + stop_thread (); +} + +void +Job::stop_thread () +{ if (_thread) { _thread->interrupt (); /* We can't use DCPOMATIC_ASSERT here as it may throw an exception */ @@ -76,6 +82,7 @@ Job::~Job () } delete _thread; + _thread = 0; } /** Start the job in a separate thread, returning immediately */ diff --git a/src/lib/job.h b/src/lib/job.h index 0e57021e0..cb85059a6 100644 --- a/src/lib/job.h +++ b/src/lib/job.h @@ -112,6 +112,7 @@ protected: void set_message (std::string m); int elapsed_sub_time () const; void check_for_interruption_or_pause (); + void stop_thread (); boost::shared_ptr<const Film> _film; diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index 356e862e0..981816fd5 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -51,6 +51,14 @@ TranscodeJob::TranscodeJob (shared_ptr<const Film> film) } +TranscodeJob::~TranscodeJob () +{ + /* We have to stop the job thread here as we're about to start tearing down + the Encoder, which is bad news if the job thread is still feeding it data. + */ + stop_thread (); +} + string TranscodeJob::name () const { diff --git a/src/lib/transcode_job.h b/src/lib/transcode_job.h index 9dd9e3684..8240977b9 100644 --- a/src/lib/transcode_job.h +++ b/src/lib/transcode_job.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -34,6 +34,7 @@ class TranscodeJob : public Job { public: explicit TranscodeJob (boost::shared_ptr<const Film> film); + ~TranscodeJob (); std::string name () const; std::string json_name () const; |
