From f23bccb3bce725041bfea050e6a4ce9a907a2af0 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Mon, 19 Sep 2022 14:07:03 +0300 Subject: Fix installer stalling when there's only one CPU core The installer operations are run in the global QThreadPool. The Operation::performOperation() implementation from "QtPatch" operation would call the Component::operations() method, that filtered the returned operation list with QtConcurrent::blockingFilter(). This would lock the installer when the global thread pool object was initialized with maxThreadCount of 1, with the only QThread object from the global pool already running the calling Operation::performOperation() function, which is waiting the result of Component::operations(). Fix by omitting usage of QtConcurrent::blockingFilter() and populating the returned operation list with std::copy_if - the components have usually only a handful operations each so this shouldn't be too noticeable of a performance regression. Task-number: QTIFW-2786 Change-Id: Ia6be9f6697310d3f955a8199712c54f345407067 Reviewed-by: Katja Marttila --- src/libs/installer/component.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/libs/installer/component.cpp') diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index c7dfa65da..37abcea8a 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -1082,10 +1082,12 @@ OperationList Component::operations(const Operation::OperationGroups &mask) cons d->m_operations.append(d->m_licenseOperation); } } - OperationList operations = d->m_operations; - QtConcurrent::blockingFilter(operations, [&](const Operation *op) { - return mask.testFlag(op->group()); - }); + OperationList operations; + std::copy_if(d->m_operations.begin(), d->m_operations.end(), std::back_inserter(operations), + [&](const Operation *op) { + return mask.testFlag(op->group()); + } + ); return operations; } -- cgit v1.2.3