[Kde-games-devel] Patch for bug #51124 (kmahjongg)
Kevin Krammer
kevin.krammer at gmx.at
Sat May 24 13:28:25 CEST 2003
On Friday 23 May 2003 22:14, Médéric BOQUIEN wrote:
> I've a little doubt on one thing though. To stop the timer, i do :
> if( timer->isActive() )
> timer->stop();
> If the timer stops after the test and before timer->stop(), it may lead
> to a crash i think. However i've never experienced it as the
I don't think you have to worry about that.
Calling stop() on an already stopped timer does no harm.
> probability of a such case is very low. Do you know if there is a way
> to avoid that? I fear my patch is not thread safe. Is there a kind of
> HOWTO around about this kind of problem? Or is it a problem in fact?
I don't think it is a problem. QTimer generates Events processed by the
main event loop. No second thread involved.
However, I think you patch misses the deleteion of the timer.
Either delete it manually in the classes destructor, make it a non pointer
class member or use "this" as its parent QObject, which will destroy it
then.
Cheers,
Kevin
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Krammer <kevin.krammer at gmx.at>
Developer at the Kmud Project http://www.kmud.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20030524/fe60059d/attachment.bin
More information about the kde-games-devel
mailing list