Cleanup: set job state to cancelled in a different place.
authorCarl Hetherington <cth@carlh.net>
Sat, 6 Aug 2022 20:36:21 +0000 (22:36 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Aug 2022 20:40:59 +0000 (22:40 +0200)
src/lib/job.cc

index 50dcc336e2fd9029b3d659246165e06d3e303f10..5bed3f0d273c6b5216ce2bb0c67b3b52c3953db2 100644 (file)
@@ -199,9 +199,7 @@ Job::run_wrapper ()
                set_state (FINISHED_ERROR);
 
        } catch (boost::thread_interrupted &) {
-
-               set_state (FINISHED_CANCELLED);
-
+               /* The job was cancelled; there's nothing else we need to do here */
        } catch (sub::SubripError& e) {
 
                string extra = "Error is near:\n";
@@ -601,6 +599,8 @@ Job::cancel ()
 
        _thread.interrupt ();
        _thread.join ();
+
+       set_state (FINISHED_CANCELLED);
 }