[Kde-games-devel] Little KGame problem

Andreas Beckermann b_mann at gmx.de
Wed May 9 15:39:30 CEST 2007


On Monday 07 May 2007, Kleag wrote:
> Hi Andreas,

Hi

> Really, thanks a lot for your work of this evening ! You got it !
> Sorry to not reply earlier but I was participating in the examination of
> the french president election in my town... Well, days of Free Software
> here are not shining. The newly elected president is the only one that said
> [1] he will not push forward Open Source but let the market decide...

Yeah I followed the elections a bit .. my condolences.

> But, back to KsirK, you say
>
> > [19:42] <bmann> ok, i found it
> > [19:42] <bmann> kleag: switch off these message boxes :-)
> > [19:42] <bmann> i suspect they're "eating" the timeout event and thus the
> > message is never processed
>
> hum, it's a problem for me. I want to remind each user what is his/her
> goal... How can I do if I cannot display a little dialog :-)
> I consider that as a bug, don't you ? And then, is the bug in my code, in
> kgame or somewhere in Qt ?

Yes sure, it's definitely a bug.
The problem was finding out where :-) From a first glance it looked a lot like 
a Qt but - but experience tells that most bugs that look like Qt bugs, are 
actually something totally different :)

I have spent quite some time after our IRC conversation hunting that beast 
down and then again today. Finally I found it, and can indeed confirm that it 
is a Qt bug. What slowed me down a lot was, that my test application was 
working for me at first: until I remembered, that I am linking it against my 
system qt in /usr, but linking KsirK against qt-copy in /opt/qt4-copy.
Once I changed that, my test application showed the same bug :-)

I have attached it: it just starts a timer with interval 0 that has a slot 
connected to it, which shows a msgbox. With Qt 4.2.3 it shows a new msgbox 
whenever you click on ok, with qt-copy it shows a single msgbox and then 
stops.

I am currently updating my qt-copy, maybe it has been fixed in the meantime, 
otherwise I am going to report the bug to trolltech.

btw about the message boxes: I find them pretty nerving. Maybe you could use 
some kind of passive popups instead? Or some kind of widget that covers the 
whole (game-)screen and where you just have to click somewhere in the widget 
(not necessarily the ok button) to make it go away?

> Next,
>
> > [19:33] <bmann> kleag: your AIPlayer class runs in a different thread.
> > [19:33] <bmann> are you sure that is a good idea?
> > [19:33] <bmann> from browsing the Qt code I am pretty sure that timers
> > may have problems with that
> > [19:34] <bmann> --> if you send an input from the AI thread (and thus
> > start a t imer), this may confuse KMessageServer
> > [19:34] <bmann> i am not sure if that actually is the problem, but that's
> > what i would be investigating next
>
> Yes, maybe the thread could be replaced by a QTimer. I choosed this
> solution before knowing well the timers.  But I'm quite sure this is not
> related to our current bug as if you play without any AI, then the bug is
> still there... Otherwise, it was working very well up to now.

Ok, then no problem here :-)
I was just worried this might be related. In general using threads for the AI 
is a pretty good idea, I just don't know if sending input from a different 
thread is allowed. But if it's working for you, then it's apparently fine.

> Thanks a lot again !

No problem

> Best regards,
>
> Kleag

CU
Andi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qtimer_bug.tar.gz
Type: application/x-tgz
Size: 782 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20070509/e213e615/attachment.bin 


More information about the kde-games-devel mailing list