From 478a8a1db3eed2c41d46da966003cc1722bd347d Mon Sep 17 00:00:00 2001 From: Karsten Heimrich Date: Wed, 6 May 2015 15:23:53 +0200 Subject: Remove pseudo static core instance, fixes autotests. We need the core engine in operations anyway, so pass the pointer to the create function instead of setting it on our own after the operation was created. The only reason to introduce the static was the ~UpdateOperation() destructor, which now can get the value from its internal data instead of using the static instance call. Change-Id: Ide27542837355ec8c642a6687ca02977983f84fa Reviewed-by: Jarek Kobus --- src/libs/installer/packagemanagercore_p.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/libs/installer/packagemanagercore_p.cpp') diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 0295454d6..7ef25a36c 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -233,7 +233,7 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q { foreach (const OperationBlob &operation, performedOperations) { QScopedPointer op(KDUpdater::UpdateOperationFactory::instance() - .create(operation.name)); + .create(operation.name, core)); if (op.isNull()) { qWarning() << QString::fromLatin1("Failed to load unknown operation %1") .arg(operation.name); @@ -551,9 +551,6 @@ void PackageManagerCorePrivate::initialize(const QHash ¶ms } processFilesForDelayedDeletion(); - foreach (Operation *currentOperation, m_performedOperationsOld) - currentOperation->setValue(QLatin1String("installer"), QVariant::fromValue(m_core)); - disconnect(this, SIGNAL(installationStarted()), ProgressCoordinator::instance(), SLOT(reset())); connect(this, SIGNAL(installationStarted()), ProgressCoordinator::instance(), SLOT(reset())); disconnect(this, SIGNAL(uninstallationStarted()), ProgressCoordinator::instance(), SLOT(reset())); @@ -649,7 +646,7 @@ QByteArray PackageManagerCorePrivate::replaceVariables(const QByteArray &ba) con */ Operation *PackageManagerCorePrivate::createOwnedOperation(const QString &type) { - m_ownedOperations.append(KDUpdater::UpdateOperationFactory::instance().create(type)); + m_ownedOperations.append(KDUpdater::UpdateOperationFactory::instance().create(type, m_core)); return m_ownedOperations.last(); } @@ -1512,7 +1509,6 @@ bool PackageManagerCorePrivate::runInstaller() binaryFile = resourcePath.filePath(QLatin1String("installer.dat")); #endif createRepo->setValue(QLatin1String("uninstall-only"), true); - createRepo->setValue(QLatin1String("installer"), QVariant::fromValue(m_core)); createRepo->setArguments(QStringList() << binaryFile << target + QLatin1String("/repository")); @@ -1892,7 +1888,7 @@ void PackageManagerCorePrivate::installComponent(Component *component, double pr if (!component->stopProcessForUpdateRequests().isEmpty()) { Operation *stopProcessForUpdatesOp = KDUpdater::UpdateOperationFactory::instance() - .create(QLatin1String("FakeStopProcessForUpdate")); + .create(QLatin1String("FakeStopProcessForUpdate"), m_core); const QStringList arguments(component->stopProcessForUpdateRequests().join(QLatin1String(","))); stopProcessForUpdatesOp->setArguments(arguments); addPerformed(stopProcessForUpdatesOp); -- cgit v1.2.3