From 36acc7bd2fb8b655b71d521e7b73c86785d7f080 Mon Sep 17 00:00:00 2001 From: Seeker4 Date: Fri, 23 Aug 2019 11:40:52 -0700 Subject: [PATCH] Fix problem that could cause CProgressBar to hang and not close --- oscar/cprogressbar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oscar/cprogressbar.cpp b/oscar/cprogressbar.cpp index a376556f..f9e3f42c 100644 --- a/oscar/cprogressbar.cpp +++ b/oscar/cprogressbar.cpp @@ -55,6 +55,9 @@ void CProgressBar::add (long count) { // See if timer limit has passed if (!progress && !timeChecked && (timer.elapsed() > timerLimit)) { + maxSteps -= numDone; // maxSteps now is number of steps remaining + numDone = 1; // and we figure only one processed so far + progress = new QProgressDialog(savedTitle, QString(), 0, maxSteps, parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint); @@ -62,8 +65,7 @@ void CProgressBar::add (long count) { progress->setValue(0); progress->setMinimumWidth(width); progress->show(); - maxSteps -= numDone; // maxSteps now is number of steps remaining - numDone = 1; // and we figure only one processed so far + QCoreApplication::processEvents(); showProgress = true; }