summaryrefslogtreecommitdiff
path: root/src/lib/writer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-09-01 19:51:53 +0100
committerCarl Hetherington <cth@carlh.net>2015-09-01 19:51:53 +0100
commita16f2c07ea7301ed1b82b9039ea7db7c025054ff (patch)
treec3cedad2e9f8634e5f6fec8836f0ea0c55f02b09 /src/lib/writer.cc
parent78d8f1166fb0f8f8cee7996e3c9b7f5d088f72df (diff)
Fix crash on cancellation of encodes during check of image data; allow cancellation during this time (#679).
Diffstat (limited to 'src/lib/writer.cc')
-rw-r--r--src/lib/writer.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 58b2b8a91..9c4a194e8 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -147,9 +147,14 @@ Writer::Writer (shared_ptr<const Film> film, weak_ptr<Job> j)
throw InvalidSignerError ();
}
- _thread = new boost::thread (boost::bind (&Writer::thread, this));
-
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.
+ */
+ _thread = new boost::thread (boost::bind (&Writer::thread, this));
}
Writer::~Writer ()