summaryrefslogtreecommitdiffstats
path: root/installerbuilder/libinstaller/component_p.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@nokia.com>2011-11-08 16:38:47 +0100
committerKarsten Heimrich <karsten.heimrich@nokia.com>2011-11-09 14:11:57 +0100
commit5a5f91a97d8af4c17e264e6c1894843e740364e3 (patch)
tree64f26d3a961ce4aa3e4489b3ad1bfdd807849272 /installerbuilder/libinstaller/component_p.cpp
parent7ccd0acdcf35b957e9e7d04cd81902bac362ad04 (diff)
Make sure we remove ui elements we added.
This fixes several problems, e.g. once a component script has been run, possible ui elements or even complete pages have been added. On a second component script run these elements would have been added again etc... Now we remove all pages and widget by default. Change-Id: I47a3283ce06767c28529201432b71c0b4f12e533 Reviewed-by: Niels Weber <niels.2.weber@nokia.com> Reviewed-by: Alexander Lenhardt <alexander.lenhardt@nokia.com> Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder/libinstaller/component_p.cpp')
-rw-r--r--installerbuilder/libinstaller/component_p.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/installerbuilder/libinstaller/component_p.cpp b/installerbuilder/libinstaller/component_p.cpp
index fb63f6d6f..a6e34aa02 100644
--- a/installerbuilder/libinstaller/component_p.cpp
+++ b/installerbuilder/libinstaller/component_p.cpp
@@ -59,6 +59,22 @@ ComponentPrivate::ComponentPrivate(PackageManagerCore *core, Component *qq)
{
}
+ComponentPrivate::~ComponentPrivate()
+{
+ // Before we can delete the added widgets, they need to be removed from the wizard first.
+ QMap<QString, QPointer<QWidget> >::const_iterator it;
+ foreach (const QString &widgetName, m_userInterfaces.keys()) {
+ m_core->removeWizardPage(q, widgetName);
+ m_core->removeWizardPageItem(q, widgetName);
+ }
+
+ // Use QPointer here instead of raw pointers. This is a requirement that needs to be met cause possible
+ // Ui elements get added during component script run and might be destroyed by the package manager gui
+ // before the actual component gets destroyed. Avoids a possible delete call on a dangling pointer.
+ foreach (const QPointer<QWidget> widget, m_userInterfaces)
+ delete widget.data();
+}
+
void ComponentPrivate::init()
{
// register translation stuff