From: Carl Hetherington Date: Tue, 1 Sep 2015 20:05:25 +0000 (+0100) Subject: Don't start thread in constructor. (Writer) X-Git-Tag: v2.1.50~2 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=cefba53fe130807e96e608ad3bbb87786b654c6e Don't start thread in constructor. (Writer) --- diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index 27e35ac52..4e8932268 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -62,6 +62,7 @@ Transcoder::Transcoder (shared_ptr film, shared_ptr j) void Transcoder::go () { + _writer->start (); _encoder->begin (); DCPTime const frame = DCPTime::from_frames (1, _film->video_frame_rate ()); diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 9c4a194e8..0e15edeca 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -148,12 +148,11 @@ Writer::Writer (shared_ptr film, weak_ptr j) } job->sub (_("Encoding image data")); +} - /* Do this last; if something after this line were to throw an exception - (say if Job::sub was interrupted by cancel) this thread would never - get properly cleaned up but the Writer object would go away underneath - it. - */ +void +Writer::start () +{ _thread = new boost::thread (boost::bind (&Writer::thread, this)); } diff --git a/src/lib/writer.h b/src/lib/writer.h index be1d3f69e..cec6ba527 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -97,6 +97,8 @@ public: Writer (boost::shared_ptr, boost::weak_ptr); ~Writer (); + void start (); + bool can_fake_write (int) const; void write (Data, int, Eyes);