From e93058cc6bf31c2ae7cbca1bf9a10a171c182260 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 7 Nov 2023 09:07:08 +0100 Subject: [PATCH] Turn worker-object into a thread. Don't do a moveToThread() anymore. --- worker.cpp | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/worker.cpp b/worker.cpp index b453444..549f59f 100644 --- a/worker.cpp +++ b/worker.cpp @@ -158,31 +158,9 @@ Worker::Worker(int customerNr, QDir::setCurrent(m_workingDirectory); m_apismVersion = getAPISMYoctoVersion(); - - this->moveToThread(&m_workerThread); - m_workerThread.start(); - - int cnt = 0; - while (!m_workerThread.isRunning()) { - if (++cnt > 5) { - Utils::printCriticalErrorMsg("starting worker thread FAILED"); - return; - } - QThread::sleep(1); - } } Worker::~Worker() { - int cnt = 0; - m_workerThread.quit(); - while (!m_workerThread.isFinished()) { - if (!m_workerThread.wait(1000)) { - if (++cnt > 5) { - Utils::printCriticalErrorMsg("stopping worker thread FAILED"); - return; - } - } - } } void Worker::displayProgressInMainWindow(int progress) { @@ -207,7 +185,7 @@ void Worker::stopProgressLoop() { } static std::once_flag once; -void Worker::update() { +void Worker::run() { // user should not start the update process several times std::call_once(once, &Worker::privateUpdate, this); }