From ca2a86dc2e65a1604916efa73fc341840954a4e8 Mon Sep 17 00:00:00 2001 From: Rob Scheepmaker Date: Fri, 12 Sep 2008 15:50:17 +0000 Subject: [PATCH] Move the calls to destroy() from save() to Applets dtor. This fixes the crashes with the popup applet patch on reviewboard (r182). CCMAIL: notmart@gmail.com svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=860301 --- applet.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/applet.cpp b/applet.cpp index f2f03b9f8..0862ced1a 100644 --- a/applet.cpp +++ b/applet.cpp @@ -125,6 +125,23 @@ Applet::Applet(QObject* parentObject, const QVariantList& args) Applet::~Applet() { + if (extender()) { + //This would probably be nicer if it was located in extender. But in it's dtor, this won't + //work since when that get's called, the applet's config() isn't accesible anymore. (same + //problem with calling saveState(). Doing this in saveState() might be a possibility, but + //that would require every extender savestate implementation to call it's parent function, + //which isn't very nice. + foreach (ExtenderItem *item, extender()->attachedItems()) { + if (!item->isDetached() || item->autoExpireDelay()) { + //destroy temporary extender items, or items that aren't detached, so their + //configuration won't linger after a plasma restart. + item->destroy(); + } + } + + extender()->saveState(); + } + if (d->transient) { d->resetConfigurationObject(); } @@ -182,23 +199,6 @@ void Applet::save(KConfigGroup &g) const KConfigGroup appletConfigGroup(&group, "Configuration"); - if (extender()) { - //This would probably be nicer if it was located in extender. But in it's dtor, this won't - //work since when that get's called, the applet's config() isn't accesible anymore. (same - //problem with calling saveState(). Doing this in saveState() might be a possibility, but - //that would require every extender savestate implementation to call it's parent function, - //which isn't very nice. - foreach (ExtenderItem *item, extender()->attachedItems()) { - if (!item->isDetached() || item->autoExpireDelay()) { - //destroy temporary extender items, or items that aren't detached, so their - //configuration won't linger after a plasma restart. - item->destroy(); - } - } - - extender()->saveState(); - } - //FIXME: we need a global save state too saveState(appletConfigGroup);