From f339cb9dcbb499fc5993770806cfeee7902891c3 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 26 Nov 2007 18:26:32 +0000 Subject: [PATCH] config().deleteGroup() doesn't removethe applet, just the configuration for the applet. we need to remove the applet's main group to properly delete an apple from the config. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=741916 --- applet.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/applet.cpp b/applet.cpp index 8d940f1d8..c02d9e073 100644 --- a/applet.cpp +++ b/applet.cpp @@ -332,6 +332,21 @@ public: pendingConstraints |= c; } + KConfigGroup mainConfigGroup(const Applet* q) + { + KConfigGroup appletConfig; + + if (q->containment()) { + appletConfig = q->containment()->config(); + appletConfig = KConfigGroup(&appletConfig, "Applets"); + } else { + kWarning() << "requesting config for" << q->name() << "without a containment!"; + appletConfig = KConfigGroup(KGlobal::config(), "Applets"); + } + + return KConfigGroup(&appletConfig, QString::number(appletId)); + } + //TODO: examine the usage of memory here; there's a pretty large // number of members at this point. uint appletId; @@ -441,16 +456,7 @@ KConfigGroup Applet::config() const return containmentConfig; } - KConfigGroup appletConfig; - if (containment()) { - appletConfig = containment()->config(); - appletConfig = KConfigGroup(&appletConfig, "Applets"); - } else { - kWarning() << "requesting config for" << name() << "without a containment!"; - appletConfig = KConfigGroup(KGlobal::config(), "Applets"); - } - - appletConfig = KConfigGroup(&appletConfig, QString::number(d->appletId)); + KConfigGroup appletConfig = d->mainConfigGroup(this); return KConfigGroup(&appletConfig, "Configuration"); } @@ -469,11 +475,12 @@ KConfigGroup Applet::globalConfig() const void Applet::destroy() { + //kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????"; if (d->configXml) { d->configXml->setDefaults(); } - config().deleteGroup(); + d->mainConfigGroup(this).deleteGroup(); deleteLater(); }