From a64ff3c7bb52007e5bb344eda11026116b4cb273 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Thu, 11 Jun 2020 20:25:22 +0200 Subject: Add Qt bug report in comment and use while() instead of do { } while();. --- src/installationmanager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/installationmanager.cpp') diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index e21a1006..b9f35af8 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -182,6 +182,7 @@ bool InstallationManager::extractFiles(QString extractPath, QString title, bool // Note: Using a loop with a progressUpdate() that only wake-up the loop. The event-loop // will be used in a loop and not via exec() because connecting to QProgressDialog::setValue // and using .exec() creates huge recursion that leads to stack-overflow. + // See https://bugreports.qt.io/browse/QTBUG-10561 QEventLoop loop; connect(this, &InstallationManager::progressUpdate, &loop, &QEventLoop::wakeUp, Qt::QueuedConnection); @@ -222,15 +223,15 @@ bool InstallationManager::extractFiles(QString extractPath, QString title, bool installationProgress->setModal(true); installationProgress->show(); - do { + while (!futureWatcher.isFinished()) { + loop.processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents); if (currentProgress != installationProgress->value()) { installationProgress->setValue(currentProgress); } if (currentFileName != installationProgress->labelText()) { installationProgress->setLabelText(currentFileName); } - loop.processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents); - } while (!futureWatcher.isFinished()); + } installationProgress->hide(); -- cgit v1.3.1