[Freeciv-Dev] Re: focus lost irrevocably on game startup (PR#506)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Thue wrote:
> On Fri, 18 Aug 2000 22:17:39 Vincent Ugenti wrote:
> > Thue wrote:
> >
> > > Den fre, 11 aug 2000 skrev skorpion@xxxxxxxxxxxxx:
> > > > Full_Name: Vincent Ugenti
> > > > Version: 1.11.0
> > > > Distribution: Built from source
> > > > Client: Gtk+
> > > > OS: Linux
> > > > Submission from: (NULL) (167.206.61.205)
> > > >
> > > >
> > > > I have observed that, if the game is started as one is scrolling the
> chat
> > > > window with the mouse, the game stops responding to mouse events.
> > > >
> > > > The country selection window opens but does not respond to mouse clicks.
> > > > Also the main window stops responding (although I would wager that is
> > > > supposed to happen). The only way to fix this is to hit ctrl-c in the
> shell
> > > > or use xkill and start a new game.
> > > >
> > > > I would imagine in practice this is quite a rare occurence, however it
> has
> > > > happened to me. Possibly it has happened to other people as well but
> they
> > > > could not reconstruct what had happened quite so easily. At any rate,
> you
> > > > will most likely need 2 computers to verify this bug since you can't
> start
> > > > the server and be scrolling the mouse at the same time on one computer.
> > > >
> > > > I was using the GTK client, have not tested the Xaw client for this bug.
> > >
> > > I can reproduce this, but I have no idea how to fix it :(
> > > And you can do it with one computer (fast Celeron 400 even), you just have
> > > to be _very_ fast :)
> > >
> > > -Thue
> >
> > The bug system will not let me reply on the BBS so I am just going to tell
> you a
> > few things I know about GUI programming in general. As far as I know, there
> are
> > no thread-safe GUI tool kits. The mouse scroll is most likely being
> > monitored
> by
> > one thread as another thread causes the new window to pop-up. I ave not
> looked
> > through the code so this is not a "fact" but I have seen enough similar
> errors
> > that I can say with confidence it is worth checking into.
> >
> > Vincent
>
> This bug report should go to gtk, no?
>
> -Thue
No, for 2 reasons. First, I have not looked at the code to confirm that this is
the source of the problem (and I have no intentions of doing so!). Secondly,
even
if the bug were as I suspect it, that would not imply any problem with GTK, as a
GUI tool kit it probably isn't and never was, nor will ever be thread safe.
Meaning, all acess to GUI objects needs to be made by the same thread. I would
attribute this bug to a race condition between two threads while accessing the
GUI.
Once again, I have not looked at the code but simply based on the behavior of
the
GUI under these circumstances reminds me of things I often see when programming
under Java and violating multithreading rules. I don't know for 100% sure if
GTK is not thread-safe, either - it's just an assumption I am making based on
the
symptoms I observed and without checking the code (although I enjoy freeciv alot
I barely have enough time to play it, let alone assist in the development
process!).
If, however, thread safety turns out to be a key issue there is a simple way to
fix it. You could have a dedicated GUI thread that accepts GUI requests from
other
threads and queues them in a manner such that only one thread is accessing the
GUI at a time. That's only one possible solution, I am sure there are others.
Vincent
|
|