summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/packagemanagercore_p.cpp
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2013-11-06 12:45:23 +0100
committerTim Jenssen <tim.jenssen@digia.com>2013-11-06 16:51:35 +0100
commit016cdad413c878be9c669398cd707ff5d1d98255 (patch)
tree384a45a3ecd01fe5b071aca445dfca9cff59a731 /src/libs/installer/packagemanagercore_p.cpp
parent0e63df370ec23e793c0bfb27c469f2606fbf104a (diff)
Restart on the wizard needs to cleanup component left-overs
- use two different script engine instances - one which lives from the beginning -> the controlScriptEngine - the other one which will be reset if there are some new repositories loaded - now the core has a pointer to the gui object, but it should only be used by the script engine so a QObject type should be enough - engines are deleted as QObject children from the PackageManagerCore - registered downloaded archives are removed Change-Id: I60a4a32fb2e409059839ec11b10c57357454f57a Reviewed-by: Michal Klocek <michal.klocek@digia.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/libs/installer/packagemanagercore_p.cpp')
-rw-r--r--src/libs/installer/packagemanagercore_p.cpp43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp
index daa0158e8..b012cff3c 100644
--- a/src/libs/installer/packagemanagercore_p.cpp
+++ b/src/libs/installer/packagemanagercore_p.cpp
@@ -212,10 +212,12 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core)
, m_repoFetched(false)
, m_updateSourcesAdded(false)
, m_componentsToInstallCalculated(false)
- , m_scriptEngine(0)
+ , m_componentScriptEngine(0)
+ , m_controlScriptEngine(0)
, m_proxyFactory(0)
, m_defaultModel(0)
, m_updaterModel(0)
+ , m_guiObject(0)
{
}
@@ -239,10 +241,12 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q
, m_updateSourcesAdded(false)
, m_magicBinaryMarker(magicInstallerMaker)
, m_componentsToInstallCalculated(false)
- , m_scriptEngine(0)
+ , m_componentScriptEngine(0)
+ , m_controlScriptEngine(0)
, m_proxyFactory(0)
, m_defaultModel(0)
, m_updaterModel(0)
+ , m_guiObject(0)
{
connect(this, SIGNAL(installationStarted()), m_core, SIGNAL(installationStarted()));
connect(this, SIGNAL(installationFinished()), m_core, SIGNAL(installationFinished()));
@@ -265,11 +269,13 @@ PackageManagerCorePrivate::~PackageManagerCorePrivate()
m_FSEngineClientHandler->setActive(false);
delete m_updateFinder;
- delete m_scriptEngine;
delete m_proxyFactory;
delete m_defaultModel;
delete m_updaterModel;
+
+ // at the moment the tabcontroller deletes the m_gui, this needs to be changed in the future
+ // delete m_gui;
}
/*!
@@ -392,11 +398,30 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c
return true;
}
-ScriptEngine *PackageManagerCorePrivate::scriptEngine()
+void PackageManagerCorePrivate::cleanUpComponentEnvironment()
+{
+ // clean up already downloaded data
+ if (QInstallerCreator::BinaryFormatEngineHandler::instance())
+ QInstallerCreator::BinaryFormatEngineHandler::instance()->resetRegisteredArchives();
+
+ // there could be still some references to already deleted components,
+ // so we need to remove the current component script engine
+ delete m_componentScriptEngine;
+ m_componentScriptEngine = 0;
+}
+
+ScriptEngine *PackageManagerCorePrivate::componentScriptEngine() const
{
- if (!m_scriptEngine)
- m_scriptEngine = new ScriptEngine(m_core);
- return m_scriptEngine;
+ if (!m_componentScriptEngine)
+ m_componentScriptEngine = new ScriptEngine(m_core);
+ return m_componentScriptEngine;
+}
+
+ScriptEngine *PackageManagerCorePrivate::controlScriptEngine() const
+{
+ if (!m_controlScriptEngine)
+ m_controlScriptEngine = new ScriptEngine(m_core);
+ return m_controlScriptEngine;
}
void PackageManagerCorePrivate::clearAllComponentLists()
@@ -411,6 +436,8 @@ void PackageManagerCorePrivate::clearAllComponentLists()
delete list.at(i).second;
m_componentsToReplaceAllMode.clear();
m_componentsToInstallCalculated = false;
+
+ cleanUpComponentEnvironment();
}
void PackageManagerCorePrivate::clearUpdaterComponentLists()
@@ -435,6 +462,8 @@ void PackageManagerCorePrivate::clearUpdaterComponentLists()
m_componentsToReplaceUpdaterMode.clear();
m_componentsToInstallCalculated = false;
+
+ cleanUpComponentEnvironment();
}
QList<Component *> &PackageManagerCorePrivate::replacementDependencyComponents()