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
This commit is contained in:
Rob Scheepmaker 2008-09-12 15:50:17 +00:00
parent 11317e0d7e
commit ca2a86dc2e

View File

@ -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);