From a12a943c99ba4aba122f91c93b078d2e87146b32 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 12 Jun 2025 00:27:33 +0200 Subject: Use a new UISignal which checks thread safety slightly. This adds a wrapper around signals2::signal which checks that emission happens from the GUI thread, for signals whose handlers must be called in the UI thread. I'm not sure how helpful it really is but maybe it catches some bad situations. --- src/lib/job_manager.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/lib/job_manager.cc') diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index c429dab6e..735b8e797 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -93,7 +93,7 @@ JobManager::add(shared_ptr j) _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr(j))); + JobAdded.emit_ui(this, weak_ptr(j)); return j; } @@ -110,7 +110,7 @@ JobManager::add_after(shared_ptr after, shared_ptr j) _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr(j))); + JobAdded.emit_ui(this, weak_ptr(j)); return j; } @@ -178,7 +178,7 @@ JobManager::scheduler() i->resume(); } auto last = _last_active_job.lock(); - emit(boost::bind(boost::ref(ActiveJobsChanged), last ? last->json_name() : std::string{}, i->json_name())); + ActiveJobsChanged.emit_ui(this, last ? last->json_name() : std::string{}, i->json_name()); _last_active_job = i; have_running = true; } else if (!have_running && i->running()) { @@ -197,7 +197,7 @@ JobManager::job_finished() { boost::mutex::scoped_lock lm(_mutex); auto job = _last_active_job.lock(); - emit(boost::bind(boost::ref(ActiveJobsChanged), job ? job->json_name() : string{}, optional())); + ActiveJobsChanged.emit_ui(this, job ? job->json_name() : string{}, optional()); _last_active_job = {}; } @@ -257,7 +257,7 @@ JobManager::analyse_audio( _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr(job))); + JobAdded.emit_ui(this, weak_ptr(job)); } @@ -292,7 +292,7 @@ JobManager::analyse_subtitles( _schedule_condition.notify_all(); } - emit(boost::bind(boost::ref(JobAdded), weak_ptr(job))); + JobAdded.emit_ui(this, weak_ptr(job)); } @@ -309,7 +309,7 @@ JobManager::increase_priority (shared_ptr job) } _schedule_condition.notify_all(); - emit(boost::bind(boost::ref(JobsReordered))); + JobsReordered.emit_ui(this); } @@ -326,7 +326,7 @@ JobManager::decrease_priority(shared_ptr job) } _schedule_condition.notify_all(); - emit(boost::bind(boost::ref(JobsReordered))); + JobsReordered.emit_ui(this); } -- cgit v1.2.3