diff --git a/worker/worker.cpp b/worker/worker.cpp index ec317cf..88c1e0a 100644 --- a/worker/worker.cpp +++ b/worker/worker.cpp @@ -58,13 +58,15 @@ bool Worker::ended() { void Worker::process() { while (!ended()) { - QMutexLocker ml(&lock); + lock.lock(); if (!qqueue.isEmpty()) { _WorkerContext *c = qqueue.dequeue(); + lock.unlock(); c->consumer(c->image.convertToFormat(c->targetFormat)); delete c->underlyingThing; delete c; - } + } else + lock.unlock(); std::this_thread::sleep_for(std::chrono::milliseconds(10)); // STL likes it's scopes } emit finished();