Bug#883707: ace-freecell crashes on KDE desktops

Esa Peuha esa.peuha at gmail.com
Tue Feb 27 19:29:35 UTC 2018


I think I've found out what is causing this bug and why it only affects
freecell. When any of these games start up, the kde window manager sends
an expose event for one pixel at the top left corner, then an expose
event for the rest of the top row of pixels, then an expose event for
the remaining pixel rows. This unusual pattern makes no difference for
the other games, because their top row of pixels contains just empty
background. However freecell puts all of its initially empty card stacks
right at the top of its window, and to make these stacks visible to the
player, each of them has the "empty" picture on them. Therefore when
freecell gets the initial one-pixel expose event, that pixel happens to
be in the leftmost empty stack, so it has to draw the "empty" picture
there. In the process of doing so, function build_image in xwin.c calls
XGetImage to get an 8x8 pixel square from the top left corner of the
window as an ximage so that it can pass the depth, format and bitmap_pad
parameters to XCreateImage. Unfortunately at that point freecell hasn't
written anything (even the background color) to 255 of the 256 pixels
because they haven't been exposed yet, and (as far as I can tell) if
*no other program* has done so either, those pixels are uninitialized
and the call to XGetImage fails; at least that seems to be why freecell
starts to work after starting and quitting any other of these games.

I don't know whether the actual bug is in xwin.c or kde (or both), and
I don't think I want to dig deeper to find out. However, it should be
easy to work around the problem in freecell by moving the tops of the
empty stacks to the second row of pixels; here's a patch to do that.
Could you try it to make sure it works?
-------------- next part --------------
--- freecell.c~	2015-06-08 16:15:20.771400783 +0300
+++ freecell.c	2018-02-27 19:47:05.272651935 +0200
@@ -71,10 +71,10 @@
 
   for (s=0; s<4; s++)
   {
-    freecells[s] = stack_create(s*W, 0);
+    freecells[s] = stack_create(s*W, 1);
     stack_set_empty_picture(freecells[s], empty);
 
-    outcells[s] = stack_create(4*W+9*M+s*W, 0);
+    outcells[s] = stack_create(4*W+9*M+s*W, 1);
     stack_set_empty_picture(outcells[s], empty);
   }
 


More information about the Pkg-games-devel mailing list