Fix conflict with the batch thread. Make sure batch thread yields to the thread opening a preview. This should eliminate (all?) crashes when something is being done while batch is running.
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
|
||||
#undef THREAD_PRIORITY_NORMAL
|
||||
|
||||
Glib::Thread *batchThread = NULL;
|
||||
Glib::Mutex* qMutex = NULL;
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl) {
|
||||
@@ -210,6 +213,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
|
||||
|
||||
void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
|
||||
|
||||
if (!qMutex)
|
||||
qMutex = new Glib::Mutex ();
|
||||
|
||||
qMutex->lock();
|
||||
ProcessingJob* currentJob = job;
|
||||
|
||||
while (currentJob) {
|
||||
@@ -219,12 +226,22 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
|
||||
bpl->error ("Can not load input image.");
|
||||
currentJob = bpl->imageReady (img);
|
||||
}
|
||||
qMutex->unlock();
|
||||
}
|
||||
|
||||
void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) {
|
||||
|
||||
|
||||
|
||||
if (bpl)
|
||||
Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, false, true, Glib::THREAD_PRIORITY_LOW);
|
||||
batchThread = Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW);
|
||||
|
||||
if(qMutex)
|
||||
{
|
||||
delete qMutex;
|
||||
qMutex = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user