diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2017-01-16 15:10:25 +0100 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2017-03-24 13:21:09 +0000 |
commit | bc84731cd487d9b77ebda247cc3e8487cc22af99 (patch) | |
tree | ac6063e8cacde0b19d2a76ea44cb8749a79b44e2 /src/libs/installer/packagemanagercore.cpp | |
parent | aca7f1fb7e544fd68adc5f05b291ebefe3a21c94 (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
(cherry picked from commit b1ed687f91d9b75e290ebabcb624684f7d177cb1)
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'src/libs/installer/packagemanagercore.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp index 3bb663b8d..8f492c06a 100644 --- a/src/libs/installer/packagemanagercore.cpp +++ b/src/libs/installer/packagemanagercore.cpp @@ -2407,23 +2407,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()) qWarning() << 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)); } } } |