From 9d395e82f0e1f25af53154f90f14f29961013e37 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 19 Aug 2020 15:32:19 +0200 Subject: [PATCH] [libcalamares] Try to avoid progress going backwards This is more a test-inspired hack than anything else: since signals are delivered asynchronously, we can end up delivering progress signals out-of-order, and then the signal spy lists them wrong: progress goes backwards. Insert a tiny delay between jobs to allow signals to be delivered in-order. --- src/libcalamares/JobQueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index 17cf11829..efe0392e5 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -134,6 +134,7 @@ public: message = result.message(); details = result.details(); } + QThread::msleep( 16 ); // Very brief rest before reporting the job as complete emitProgress( 1.0 ); // 100% for *this job* } m_jobIndex++; @@ -158,7 +159,6 @@ public: qreal progress = 0.0; if ( m_jobIndex < m_runningJobs->count() ) { - const auto& jobitem = m_runningJobs->at( m_jobIndex ); progress = ( jobitem.cumulative + jobitem.weight * percentage ) / m_overallQueueWeight; message = jobitem.job->prettyStatusMessage();