diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-02-20 23:10:50 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-02-23 01:47:38 +0100 |
| commit | 81d8c747c7a04be10821223dea69faf058b05b1d (patch) | |
| tree | 98f58e45012c3133e719024fe8c84d7b9c691811 /src/lib | |
| parent | 6628b2573f601b7448da169453d5f113534e525e (diff) | |
Allow verification of multiple DCPs in one go (#2843).
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/job_manager.cc | 10 | ||||
| -rw-r--r-- | src/lib/job_manager.h | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index 86230db2b..3fac8e6fa 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -177,8 +177,9 @@ JobManager::scheduler () } else { i->resume (); } - emit (boost::bind (boost::ref (ActiveJobsChanged), _last_active_job, i->json_name())); - _last_active_job = i->json_name (); + auto last = _last_active_job.lock(); + emit(boost::bind(boost::ref(ActiveJobsChanged), last ? last->json_name() : std::string{}, i->json_name())); + _last_active_job = i; have_running = true; } else if (!have_running && i->running()) { have_running = true; @@ -195,8 +196,9 @@ JobManager::job_finished () { { boost::mutex::scoped_lock lm (_mutex); - emit (boost::bind(boost::ref (ActiveJobsChanged), _last_active_job, optional<string>())); - _last_active_job = optional<string>(); + auto job = _last_active_job.lock(); + emit(boost::bind(boost::ref(ActiveJobsChanged), job ? job->json_name() : string{}, optional<string>())); + _last_active_job = {}; } _schedule_condition.notify_all(); diff --git a/src/lib/job_manager.h b/src/lib/job_manager.h index c8450bfda..b4cb49060 100644 --- a/src/lib/job_manager.h +++ b/src/lib/job_manager.h @@ -65,6 +65,10 @@ public: return _paused; } + std::weak_ptr<Job> last_active_job() const { + return _last_active_job; + } + void analyse_audio ( std::shared_ptr<const Film> film, std::shared_ptr<const Playlist> playlist, @@ -105,7 +109,7 @@ private: std::list<boost::signals2::connection> _connections; bool _terminate = false; - boost::optional<std::string> _last_active_job; + std::weak_ptr<Job> _last_active_job; boost::thread _scheduler; /** true if all jobs should be paused */ |
