summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2023-02-02 15:24:39 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2023-02-03 10:10:07 +0200
commiteaa5b874e6ea47f3ec8692a401e38156e63b5f5b (patch)
tree35db0c5e9255af90f8bee2d809d99a9abfe59d3a
parentdb2d27e29b526a6e1439be721a24a9ec5166d81a (diff)
Fix updating of install action states for components
The states were only updated at the end of PackageManagerCore ::recalculateAllComponents() method - the method calls: PackageManagerCore::calculateComponentsToInstall() and PackageManagerCore::calculateComponentsToUninstall() functions in that order, and both emit signals indicating the finishing of the calculation. Any install script connecting to these signals that relies on the correct state of the install actions for the components would work incorrectly, as the state was not updated to reflect the calculation result yet. Fix by updating the install action state in both functions before emitting their finished signals. Also rename the function to better distinguish its purpose from updating the check state of the components. Task-number: QTIFW-2976 Change-Id: I67cd88478c39215ec124a5451c1f29a63cb1c82c Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--src/libs/installer/packagemanagercore.cpp6
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp2
-rw-r--r--src/libs/installer/packagemanagercore_p.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index db6c692e2..6a449c69a 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -633,8 +633,6 @@ bool PackageManagerCore::recalculateAllComponents()
if (!isInstaller() && !calculateComponentsToUninstall())
return false;
- // update install actions
- d->updateComponentCheckedState();
// update all nodes uncompressed size
foreach (Component *const component, components(ComponentType::Root))
component->updateUncompressedSize(); // this is a recursive call
@@ -2186,6 +2184,8 @@ bool PackageManagerCore::calculateComponentsToInstall() const
const bool componentsToInstallCalculated =
d->installerCalculator()->appendComponentsToInstall(selectedComponentsToInstall);
+ d->updateComponentInstallActions();
+
emit finishedCalculateComponentsToInstall();
return componentsToInstallCalculated;
}
@@ -2291,6 +2291,8 @@ bool PackageManagerCore::calculateComponentsToUninstall() const
const bool componentsToUninstallCalculated =
d->uninstallerCalculator()->appendComponentsToUninstall(selectedComponentsToUninstall);
+ d->updateComponentInstallActions();
+
emit finishedCalculateComponentsToUninstall();
return componentsToUninstallCalculated;
}
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index 6d56791a0..cce093dc2 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -2922,7 +2922,7 @@ void PackageManagerCorePrivate::storeCheckState()
m_coreCheckedHash.insert(component, component->checkState());
}
-void PackageManagerCorePrivate::updateComponentCheckedState()
+void PackageManagerCorePrivate::updateComponentInstallActions()
{
for (Component *component : m_core->components(PackageManagerCore::ComponentType::All)) {
component->setInstallAction(component->isInstalled()
diff --git a/src/libs/installer/packagemanagercore_p.h b/src/libs/installer/packagemanagercore_p.h
index aaf9e27be..f316d0363 100644
--- a/src/libs/installer/packagemanagercore_p.h
+++ b/src/libs/installer/packagemanagercore_p.h
@@ -274,7 +274,7 @@ private:
void commitPendingUnstableComponents();
void createAutoDependencyHash(const QString &componentName, const QString &oldValue, const QString &newValue);
void createLocalDependencyHash(const QString &componentName, const QString &dependencies);
- void updateComponentCheckedState();
+ void updateComponentInstallActions();
// remove once we deprecate isSelected, setSelected etc...
void restoreCheckState();