Problem with appletRemoved signal
Alexis Ménard
menard at kde.org
Mon Jan 26 15:21:58 CET 2009
Hello folks,
There is a problem with appletRemoved public signal in containment. Here is
the signature :
/**
* This signal is emitted when an applet is destroyed
*/
void appletRemoved(Plasma::Applet *applet);
So a containment that is connected to this signal expect an Applet pointer.
But who emit this signal? Our beloved base class Containment which is
connected to the QObject destroyed signal of the applet.
Here is the slot :
void ContainmentPrivate::appletDestroyed(QObject *object);
When we arrive in the this slot applet destructor has been already called.
Since we do a static_cast just because we need the value of the pointer,
it's ok. BUT after we call :
emit q->appletRemoved(applet); with the pointer we get after the
static_cast.
Aie aie aie. Valgrind complain and we never know, people can use the pointer
to do some stuff when they get the appletRemoved signal, (we already do that
in our panel.cpp class). Luckily it doesn't crash but it can happen.
I have attach a patch that create a appletDestroyed signal that is emit just
after entering in Applet destructor. I wanted to use destroyed but we have
already a method called like this.
I guess if people agreed that i should backport it to 4.2 branch.
Is it OK?
PS : Sorry for don't using the review board but it doesn't work with git, i
don't have the svn revision.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090126/a4faf2f6/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma.diff
Type: text/x-patch
Size: 3801 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090126/a4faf2f6/attachment.diff
More information about the Plasma-devel
mailing list