[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.2/kdelibs/plasma
From: Alexis Ménard <menard () kde ! org>
Date: 2009-01-28 8:13:20
Message-ID: 1233130400.565614.10824.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 917622 by menard:
SVN commit 917619
Add an appletDestroyed signal instead of catching the destruction in containments \
with qobject destroyed signal. This fix errors because we give an invalid pointer to \
public appletRemoved signal.
M +3 -0 applet.cpp
M +5 -0 applet.h
M +2 -10 containment.cpp
M +1 -1 containment.h
M +1 -1 private/containment_p.h
--- branches/KDE/4.2/kdelibs/plasma/applet.cpp #917621:917622
@@ -133,6 +133,9 @@
Applet::~Applet()
{
+ //let people know that i will die
+ emit appletDestroyed(this);
+
if (d->transient) {
d->resetConfigurationObject();
} else if (d->extender) {
--- branches/KDE/4.2/kdelibs/plasma/applet.h #917621:917622
@@ -609,6 +609,11 @@
*/
void activate();
+ /**
+ * Emitted when the applet is deleted
+ */
+ void appletDestroyed(Plasma::Applet *applet);
+
public Q_SLOTS:
/**
* Sets the immutability type for this applet (not immutable,
--- branches/KDE/4.2/kdelibs/plasma/containment.cpp #917621:917622
@@ -742,7 +742,7 @@
connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving()));
connect(applet, SIGNAL(releaseVisualFocus()), this, \
SIGNAL(releaseVisualFocus()));
- connect(applet, SIGNAL(destroyed(QObject*)), this, \
SLOT(appletDestroyed(QObject*))); + connect(applet, \
SIGNAL(appletDestroyed(Plasma::Applet*)), this, \
SLOT(appletDestroyed(Plasma::Applet*)));
if (pos != QPointF(-1, -1)) {
applet->setPos(pos);
@@ -1709,16 +1709,8 @@
return true;
}
-void ContainmentPrivate::appletDestroyed(QObject *object)
+void ContainmentPrivate::appletDestroyed(Plasma::Applet *applet)
{
- // we do a static_cast here since it really isn't an Applet by this
- // point anymore since we are in the qobject dtor. we don't actually
- // try and do anything with it, we just need the value of the pointer
- // so this unsafe looking code is actually just fine.
- //
- // NOTE: DO NOT USE THE applet VARIABLE FOR ANYTHING OTHER THAN COMPARING
- // THE ADDRESS! ACTUALLY USING THE OBJECT WILL RESULT IN A CRASH!!!
- Applet *applet = static_cast<Plasma::Applet*>(object);
applets.removeAll(applet);
if (focusedApplet == applet) {
focusedApplet = 0;
--- branches/KDE/4.2/kdelibs/plasma/containment.h #917621:917622
@@ -507,7 +507,7 @@
const QGraphicsItem *toolBoxItem() const;
private:
- Q_PRIVATE_SLOT(d, void appletDestroyed(QObject*))
+ Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*))
Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem \
*item,
\
Plasma::Animator::Animation anim)) Q_PRIVATE_SLOT(d, void triggerShowAddWidgets())
--- branches/KDE/4.2/kdelibs/plasma/private/containment_p.h #917621:917622
@@ -75,7 +75,7 @@
void positionContainments();
void setLockToolText();
void handleDisappeared(AppletHandle *handle);
- void appletDestroyed(QObject*);
+ void appletDestroyed(Plasma::Applet*);
void containmentAppletAnimationComplete(QGraphicsItem *item, \
Plasma::Animator::Animation anim); void zoomIn();
void zoomOut();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic