Fix another case where an exception could be thrown from a destructor.
authorCarl Hetherington <cth@carlh.net>
Mon, 20 Jun 2016 16:06:58 +0000 (17:06 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 20 Jun 2016 16:06:58 +0000 (17:06 +0100)
src/lib/job.cc

index 75a5505a95d82c1e4e738b802cb739bc16c0d40f..ba91debb79f7565e956196604468ec52985b5610 100644 (file)
@@ -62,8 +62,14 @@ Job::~Job ()
 {
        if (_thread) {
                _thread->interrupt ();
-               DCPOMATIC_ASSERT (_thread->joinable ());
-               _thread->join ();
+               /* We can't use DCPOMATIC_ASSERT here as it may throw an exception */
+               if (_thread->joinable ()) {
+                       try {
+                               _thread->join ();
+                       } catch (...) {
+                               /* Too late to do anything about this */
+                       }
+               }
        }
 
        delete _thread;