From 2b91608b8287be79c9c1bbfa91e7388e5925638b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 27 May 2019 17:10:21 +0200 Subject: [PATCH] [libcalamaresui] Avoid requirements-results UI duplication If the requirements checking is **really fast**, e.g. you don't have a check for internet connectivity, then the checks might be done as fast as the 0-timeout single-shot timer, which means that finished() is called once by the QFutureWatcher, and then after that by the QTimer .. leading to two messages "All requirements have been checked", but also twice requirementsComplete being emitted, so you end up with two results lists being added by the CheckerContainer. Stop that by using the results-progress timer as an additional flag: the first time everything is complete, delete that timer and set the pointer back to nullptr. --- src/libcalamaresui/modulesystem/RequirementsChecker.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libcalamaresui/modulesystem/RequirementsChecker.cpp b/src/libcalamaresui/modulesystem/RequirementsChecker.cpp index 7eccdbbc0..562204a2c 100644 --- a/src/libcalamaresui/modulesystem/RequirementsChecker.cpp +++ b/src/libcalamaresui/modulesystem/RequirementsChecker.cpp @@ -99,12 +99,15 @@ RequirementsChecker::run() void RequirementsChecker::finished() { - if ( std::all_of( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher *w ) { return w && w->isFinished(); } ) ) + if ( m_progressTimer && std::all_of( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher *w ) { return w && w->isFinished(); } ) ) { cDebug() << "All requirements have been checked."; - if ( m_progressTimer ) + { m_progressTimer->stop(); + delete m_progressTimer; + m_progressTimer = nullptr; + } bool acceptable = true; int count = 0;