diff --git a/rtgui/batchqueuepanel.cc b/rtgui/batchqueuepanel.cc index f572a6772..b61f60ee7 100644 --- a/rtgui/batchqueuepanel.cc +++ b/rtgui/batchqueuepanel.cc @@ -286,6 +286,7 @@ void BatchQueuePanel::startBatchProc () // Update switch when queue started programmatically qStartStopConn.block (true); qStartStop->set_active(true); + qStartStopState = true; qStartStopConn.block (false); if (batchQueue->hasJobs()) { @@ -308,6 +309,7 @@ void BatchQueuePanel::stopBatchProc () // Update switch when queue started programmatically qStartStopConn.block (true); qStartStop->set_active(false); + qStartStopState = false; qStartStopConn.block (false); updateTab (batchQueue->getEntries().size()); @@ -324,14 +326,9 @@ void BatchQueuePanel::addBatchQueueJobs(const std::vector& ent bool BatchQueuePanel::canStartNext () { -// GThreadLock lock; - if (qStartStop->get_active()) { - return true; - } else { - fdir->set_sensitive (true); - fformat->set_sensitive (true); - return false; - } + // This function is called from the background BatchQueue thread. + // It cannot call UI functions, so grab the stored state of qStartStop. + return qStartStopState; } void BatchQueuePanel::saveOptions () diff --git a/rtgui/batchqueuepanel.h b/rtgui/batchqueuepanel.h index 73cb3ba6e..89b8d8910 100644 --- a/rtgui/batchqueuepanel.h +++ b/rtgui/batchqueuepanel.h @@ -19,6 +19,8 @@ #ifndef _BATCHQUEUEPANEL_ #define _BATCHQUEUEPANEL_ +#include + #include #include "batchqueue.h" #include "saveformatpanel.h" @@ -53,6 +55,8 @@ class BatchQueuePanel : public Gtk::VBox, IdleRegister idle_register; + std::atomic qStartStopState; + public: explicit BatchQueuePanel (FileCatalog* aFileCatalog); ~BatchQueuePanel();