summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2017-01-16 15:10:25 +0100
committerKatja Marttila <katja.marttila@qt.io>2017-01-20 05:36:54 +0000
commitb1ed687f91d9b75e290ebabcb624684f7d177cb1 (patch)
tree501fa2bea015e93db90ba53b435ed0874d7dda1c /src
parent2ac28386a64327715a9795d0d0b55c234de0cef5 (diff)
Fix installer crash when it contains replaced and replacement component
Do not execute the component script of a to be replaced component. This make no sense at all, cause in case of installer it is hidden and we can't install it anyway. Task-number: QTIFW-915 Change-Id: Ia0378047b162dafb854dff24e77a113b27885f9d Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagercore.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index d4391638f..e2495c09b 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -2612,23 +2612,24 @@ void PackageManagerCore::storeReplacedComponents(QHash<QString, Component *> &co
// remember all components that got a replacement, required for uninstall
for (; it != data.replacementToExchangeables.constEnd(); ++it) {
foreach (const QString &componentName, it.value()) {
- Component *component = components.take(componentName);
- // if one component has a replaces which is not existing in the current component list anymore
- // just ignore it
- if (!component) {
- // This case can happen when in installer mode, but should not occur when updating
+ Component *componentToReplace = components.take(componentName);
+ if (!componentToReplace) {
+ // If a component replaces another component which is not existing in the
+ // installer binary or the installed component list, just ignore it. This
+ // can happen when in installer mode and probably package manager mode too.
if (isUpdater())
qDebug() << componentName << "- Does not exist in the repositories anymore.";
continue;
}
- if (!component && !d->componentsToReplace().contains(componentName)) {
- component = new Component(this);
- component->setValue(scName, componentName);
+ if (!componentToReplace && !d->componentsToReplace().contains(componentName)) {
+ componentToReplace = new Component(this);
+ componentToReplace->setValue(scName, componentName);
} else {
- component->loadComponentScript();
- d->replacementDependencyComponents().append(component);
+ // This case can happen when in installer mode as well, a component
+ // is in the installer binary and its replacement component as well.
+ d->replacementDependencyComponents().append(componentToReplace);
}
- d->componentsToReplace().insert(componentName, qMakePair(it.key(), component));
+ d->componentsToReplace().insert(componentName, qMakePair(it.key(), componentToReplace));
}
}
}