Allow cancellation of un-started jobs (#2777).
[dcpomatic.git] / src / lib / job.cc
index 5bed3f0d273c6b5216ce2bb0c67b3b52c3953db2..8f0a7474f90311ffc8c3fa912bc9b22ca57dad1e 100644 (file)
@@ -589,17 +589,15 @@ Job::remaining_time () const
 void
 Job::cancel ()
 {
-       if (!_thread.joinable()) {
-               return;
-       }
+       if (_thread.joinable()) {
+               if (paused_by_user() || paused_by_priority()) {
+                       resume ();
+               }
 
-       if (paused_by_user() || paused_by_priority()) {
-               resume ();
+               _thread.interrupt ();
+               _thread.join ();
        }
 
-       _thread.interrupt ();
-       _thread.join ();
-
        set_state (FINISHED_CANCELLED);
 }