cleanups and another remove-before-deletion

svn path=/trunk/KDE/kdelibs/; revision=1012704
This commit is contained in:
Aaron J. Seigo 2009-08-18 01:05:37 +00:00
parent b6cd1d8582
commit 1e7c17ae24

View File

@ -1,5 +1,3 @@
#ifndef APPLET_CPP
#define APPLET_CPP
/* /*
* Copyright 2005 by Aaron Seigo <aseigo@kde.org> * Copyright 2005 by Aaron Seigo <aseigo@kde.org>
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org> * Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org>
@ -93,7 +91,6 @@
#include "private/popupapplet_p.h" #include "private/popupapplet_p.h"
#include "private/toolbox_p.h" #include "private/toolbox_p.h"
//#define DYNAMIC_SHADOWS
namespace Plasma namespace Plasma
{ {
@ -438,11 +435,9 @@ bool Applet::destroyed() const
void AppletPrivate::appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim) void AppletPrivate::appletAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation anim)
{ {
if (anim != Animator::DisappearAnimation || item != q) { if (anim == Animator::DisappearAnimation && item == q) {
return; //it's not our time yet cleanUpAndDelete();
} }
cleanUpAndDelete();
} }
void AppletPrivate::selectItemToDestroy() void AppletPrivate::selectItemToDestroy()
@ -2540,6 +2535,9 @@ void AppletOverlayWidget::destroy()
void AppletOverlayWidget::overlayAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation) void AppletOverlayWidget::overlayAnimationComplete(QGraphicsItem *item, Plasma::Animator::Animation)
{ {
if (item == this) { if (item == this) {
if (scene()) {
scene()->removeItem(this);
}
deleteLater(); deleteLater();
} }
} }
@ -2582,4 +2580,3 @@ void AppletOverlayWidget::paint(QPainter *painter,
#include "applet.moc" #include "applet.moc"
#include "private/applet_p.moc" #include "private/applet_p.moc"
#endif // APPLET_CPP