batch queue racing condition patch by steve.herrel 270

This commit is contained in:
Andrey Skvortsov
2010-10-20 21:18:59 -07:00
parent 75c4f12ee8
commit ba9e2c4879
2 changed files with 508 additions and 524 deletions

View File

@@ -29,9 +29,6 @@
#undef THREAD_PRIORITY_NORMAL #undef THREAD_PRIORITY_NORMAL
Glib::Thread *batchThread = NULL;
Glib::Mutex* qMutex = NULL;
namespace rtengine { namespace rtengine {
IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl) { IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl) {
@@ -221,10 +218,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) { void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
if (!qMutex)
qMutex = new Glib::Mutex ();
qMutex->lock();
ProcessingJob* currentJob = job; ProcessingJob* currentJob = job;
while (currentJob) { while (currentJob) {
@@ -234,21 +227,12 @@ void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl) {
bpl->error ("Can not load input image."); bpl->error ("Can not load input image.");
currentJob = bpl->imageReady (img); currentJob = bpl->imageReady (img);
} }
qMutex->unlock();
} }
void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) { void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl) {
if (bpl) if (bpl)
batchThread = Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW); Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl), 0, true, true, Glib::THREAD_PRIORITY_LOW);
if(qMutex)
{
delete qMutex;
qMutex = NULL;
}
} }

View File

@@ -78,7 +78,7 @@ BatchQueuePanel::BatchQueuePanel () {
saveFormatPanel->init (options.saveFormat); saveFormatPanel->init (options.saveFormat);
outdirTemplate->set_text (options.savePathTemplate); outdirTemplate->set_text (options.savePathTemplate);
if (Glib::file_test (options.savePathFolder, Glib::FILE_TEST_IS_DIR)) if (Glib::file_test (options.savePathFolder, Glib::FILE_TEST_IS_DIR))
outdirFolder->set_filename (options.savePathFolder); outdirFolder->set_current_folder (options.savePathFolder);
useTemplate->set_active (options.saveUsePathTemplate); useTemplate->set_active (options.saveUsePathTemplate);
useFolder->set_active (!options.saveUsePathTemplate); useFolder->set_active (!options.saveUsePathTemplate);
@@ -259,7 +259,7 @@ void BatchQueuePanel::saveOptions () {
// since these settings are shared with editorpanel : // since these settings are shared with editorpanel :
void BatchQueuePanel::pathFolderChanged () { void BatchQueuePanel::pathFolderChanged () {
options.savePathFolder = outdirFolder->get_filename(); options.savePathFolder = outdirFolder->get_current_folder();
} }
void BatchQueuePanel::formatChanged (Glib::ustring f) { void BatchQueuePanel::formatChanged (Glib::ustring f) {