<br><br><div class="gmail_quote">On Sat, Feb 26, 2011 at 10:10 AM, Kun Zhang <span dir="ltr">&lt;<a href="mailto:arthur.kun@gmail.com">arthur.kun@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br><br>I&#39;m writing a plasmoid with Python. I have a QTimer to do refresh stuff and it works fine, unless I remove the plasmoid from desktop and the timer&#39;s access to applet.isUnderMouse() will cause the whole plasma desktop to crash.<br>

<br>I have confirmed that plasma won&#39;t crash if I don&#39;t start the timer, so I think if I could stop the timer before the plasmoid is being destroyed, the crash can be prevented.<br><br>I tried the following signals:<br>

connect(applet, SIGNAL(&quot;destroyed(QObject)&quot;), self.onDestroy)<br>connect(applet, SIGNAL(&quot;appletDestroyed(Plasma.Applet)&quot;), self.onDestroy)<br>but it seems the onDestroy() method is never triggered.<br clear="all">

<br>I also tried checking applet.isDestroyed() in the timer&#39;s handler, but it always returns false, thus helpless.<br><br>Does anybody has an idea?<br>-- <br>Best wishes<br><font color="#888888">ZHANG Kun<br>
</font></blockquote></div><br><br>Apologies. I found the correct signal signature should be in C++ style, despite that I&#39;m using python. This signal connection works:<br><br>connect(applet, SIGNAL(&quot;appletDestroyed(Plasma::Applet*)&quot;), self.onDestroy)<br>
<br clear="all"><br>-- <br>Best wishes<br>ZHANG Kun<br>