diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-03-06 20:59:58 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-03-06 20:59:58 +0000 |
| commit | e03d6f9bc6af9dfa8602c82cc52040a92144deaf (patch) | |
| tree | 3ca44d6b77f8e9184063d7cd29d849b1f7b290c3 /src/lib/job.cc | |
| parent | b93430a73313d705f7f51315db705cfcf9942297 (diff) | |
Destroy Job threads at the start of the subclass destructors,
so that the thread is gone before the object is torn down.
Diffstat (limited to 'src/lib/job.cc')
| -rw-r--r-- | src/lib/job.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc index 451776524..d4023973c 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -62,6 +62,15 @@ Job::Job (shared_ptr<const Film> film) Job::~Job () { +#ifdef DCPOMATIC_DEBUG + /* Any subclass should have called destroy_thread in its destructor */ + assert (!_thread); +#endif +} + +void +Job::destroy_thread () +{ if (_thread) { _thread->interrupt (); /* We can't use DCPOMATIC_ASSERT here as it may throw an exception */ @@ -75,6 +84,7 @@ Job::~Job () } delete _thread; + _thread = 0; } /** Start the job in a separate thread, returning immediately */ |
