Merge master branch.
[dcpomatic.git] / src / lib / job_manager.cc
index 1fae179656222b299192d71652ad5abe719ec844..fa02fd37014454cb992e74bb800290c85e762957 100644 (file)
@@ -100,6 +100,11 @@ JobManager::scheduler ()
                {
                        boost::mutex::scoped_lock lm (_mutex);
                        for (list<shared_ptr<Job> >::iterator i = _jobs.begin(); i != _jobs.end(); ++i) {
+
+                               if (!(*i)->finished ()) {
+                                       active_jobs = true;
+                               }
+                               
                                if ((*i)->running ()) {
                                        /* Something is already happening */
                                        break;
@@ -114,16 +119,14 @@ JobManager::scheduler ()
                                                break;
                                        }
                                }
-
-                               if (!(*i)->finished ()) {
-                                       active_jobs = true;
-                               }
                        }
                }
 
                if (active_jobs != _last_active_jobs) {
                        _last_active_jobs = active_jobs;
-                       ui_signaller->emit (boost::bind (boost::ref (ActiveJobsChanged), active_jobs));
+                       if (ui_signaller) {
+                               ui_signaller->emit (boost::bind (boost::ref (ActiveJobsChanged), active_jobs));
+                       }
                }
 
                dvdomatic_sleep (1);