From: Carl Hetherington Date: Fri, 6 Mar 2020 21:36:16 +0000 (+0100) Subject: Stop threads at the start of their object's destruction in all Job cases. X-Git-Tag: v2.15.48~26 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=caf67bef2611a911307267b20dbf3be89ffff71f Stop threads at the start of their object's destruction in all Job cases. --- diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 9d0882b3a..ad28dcfd4 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -83,6 +83,7 @@ AnalyseAudioJob::AnalyseAudioJob (shared_ptr film, shared_ptr (i); } diff --git a/src/lib/check_content_change_job.cc b/src/lib/check_content_change_job.cc index e1226e79c..1df3bc9cd 100644 --- a/src/lib/check_content_change_job.cc +++ b/src/lib/check_content_change_job.cc @@ -42,6 +42,11 @@ CheckContentChangeJob::CheckContentChangeJob (shared_ptr film, share } +CheckContentChangeJob::~CheckContentChangeJob () +{ + stop_thread (); +} + string CheckContentChangeJob::name () const { diff --git a/src/lib/check_content_change_job.h b/src/lib/check_content_change_job.h index 355dedf83..152cdb9e7 100644 --- a/src/lib/check_content_change_job.h +++ b/src/lib/check_content_change_job.h @@ -28,6 +28,7 @@ class CheckContentChangeJob : public Job { public: CheckContentChangeJob (boost::shared_ptr, boost::shared_ptr following = boost::shared_ptr(), bool gui = true); + ~CheckContentChangeJob (); std::string name () const; std::string json_name () const; diff --git a/src/lib/examine_content_job.cc b/src/lib/examine_content_job.cc index 86e0a107e..3be38863d 100644 --- a/src/lib/examine_content_job.cc +++ b/src/lib/examine_content_job.cc @@ -38,6 +38,11 @@ ExamineContentJob::ExamineContentJob (shared_ptr film, shared_ptr, boost::shared_ptr); + ~ExamineContentJob (); std::string name () const; std::string json_name () const; diff --git a/src/lib/examine_ffmpeg_subtitles_job.cc b/src/lib/examine_ffmpeg_subtitles_job.cc index b9d5f54e5..b2bba11cd 100644 --- a/src/lib/examine_ffmpeg_subtitles_job.cc +++ b/src/lib/examine_ffmpeg_subtitles_job.cc @@ -43,6 +43,11 @@ ExamineFFmpegSubtitlesJob::ExamineFFmpegSubtitlesJob (shared_ptr fil } +ExamineFFmpegSubtitlesJob::~ExamineFFmpegSubtitlesJob () +{ + stop_thread (); +} + string ExamineFFmpegSubtitlesJob::name () const { diff --git a/src/lib/examine_ffmpeg_subtitles_job.h b/src/lib/examine_ffmpeg_subtitles_job.h index 5960a9cc3..0a0101193 100644 --- a/src/lib/examine_ffmpeg_subtitles_job.h +++ b/src/lib/examine_ffmpeg_subtitles_job.h @@ -28,6 +28,7 @@ class ExamineFFmpegSubtitlesJob : public Job, public FFmpeg { public: ExamineFFmpegSubtitlesJob (boost::shared_ptr, boost::shared_ptr); + ~ExamineFFmpegSubtitlesJob (); std::string name () const; std::string json_name () const; diff --git a/src/lib/job.cc b/src/lib/job.cc index 04aa227b7..a83249e79 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -62,7 +62,10 @@ Job::Job (shared_ptr film) Job::~Job () { - stop_thread (); +#ifdef DCPOMATIC_DEBUG + /* Any subclass should have called stop_thread in its destructor */ + assert (!_thread.joinable()); +#endif } void diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index 38484b91e..1b476fa63 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -53,6 +53,11 @@ SendKDMEmailJob::SendKDMEmailJob ( } +SendKDMEmailJob::~SendKDMEmailJob () +{ + stop_thread (); +} + string SendKDMEmailJob::name () const { diff --git a/src/lib/send_kdm_email_job.h b/src/lib/send_kdm_email_job.h index 0b64db7a8..a7196fe15 100644 --- a/src/lib/send_kdm_email_job.h +++ b/src/lib/send_kdm_email_job.h @@ -40,6 +40,7 @@ public: dcp::NameFormat::Map name_values, std::string cpl_name ); + ~SendKDMEmailJob (); std::string name () const; std::string json_name () const; diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc index abbb844e2..1c9d96338 100644 --- a/src/lib/send_notification_email_job.cc +++ b/src/lib/send_notification_email_job.cc @@ -40,6 +40,11 @@ SendNotificationEmailJob::SendNotificationEmailJob (string body) } +SendNotificationEmailJob::~SendNotificationEmailJob () +{ + stop_thread (); +} + string SendNotificationEmailJob::name () const { diff --git a/src/lib/send_notification_email_job.h b/src/lib/send_notification_email_job.h index 04f1d98ab..5c116f2ee 100644 --- a/src/lib/send_notification_email_job.h +++ b/src/lib/send_notification_email_job.h @@ -24,6 +24,7 @@ class SendNotificationEmailJob : public Job { public: explicit SendNotificationEmailJob (std::string body); + ~SendNotificationEmailJob (); std::string name () const; std::string json_name () const; diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc index 11f700de0..d27609f0b 100644 --- a/src/lib/send_problem_report_job.cc +++ b/src/lib/send_problem_report_job.cc @@ -52,6 +52,11 @@ SendProblemReportJob::SendProblemReportJob ( } +SendProblemReportJob::~SendProblemReportJob () +{ + stop_thread (); +} + string SendProblemReportJob::name () const { diff --git a/src/lib/send_problem_report_job.h b/src/lib/send_problem_report_job.h index c4371a54e..af1a4b269 100644 --- a/src/lib/send_problem_report_job.h +++ b/src/lib/send_problem_report_job.h @@ -31,6 +31,8 @@ public: std::string summary ); + ~SendProblemReportJob (); + std::string name () const; std::string json_name () const; void run (); diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index 7fe28d210..fb586b082 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -54,9 +54,6 @@ TranscodeJob::TranscodeJob (shared_ptr 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 (); } diff --git a/src/lib/upload_job.cc b/src/lib/upload_job.cc index b229fddbe..fbfbb92d8 100644 --- a/src/lib/upload_job.cc +++ b/src/lib/upload_job.cc @@ -46,6 +46,11 @@ UploadJob::UploadJob (shared_ptr film) } +UploadJob::~UploadJob () +{ + stop_thread (); +} + string UploadJob::name () const { diff --git a/src/lib/upload_job.h b/src/lib/upload_job.h index 407094ab8..3a613fd72 100644 --- a/src/lib/upload_job.h +++ b/src/lib/upload_job.h @@ -28,6 +28,7 @@ class UploadJob : public Job { public: explicit UploadJob (boost::shared_ptr); + ~UploadJob (); std::string name () const; std::string json_name () const; diff --git a/src/lib/verify_dcp_job.cc b/src/lib/verify_dcp_job.cc index 908cd53a7..c1dcbc792 100644 --- a/src/lib/verify_dcp_job.cc +++ b/src/lib/verify_dcp_job.cc @@ -36,6 +36,11 @@ VerifyDCPJob::VerifyDCPJob (vector directories) } +VerifyDCPJob::~VerifyDCPJob () +{ + stop_thread (); +} + string VerifyDCPJob::name () const { diff --git a/src/lib/verify_dcp_job.h b/src/lib/verify_dcp_job.h index a93a7adfa..2cff5ab6c 100644 --- a/src/lib/verify_dcp_job.h +++ b/src/lib/verify_dcp_job.h @@ -28,6 +28,7 @@ class VerifyDCPJob : public Job { public: explicit VerifyDCPJob (std::vector directories); + ~VerifyDCPJob (); std::string name () const; std::string json_name () const;