Re: [AD] [XWIN] SHM bug.

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> With the latest Allegro (just did a cvs upd), using any function except
> blit to draw directly to the screen causes a 'BadAccess' error from X.

Here are the results of my investigations: the program

#include <stdio.h>
#include <allegro.h>

int main(void)
{
   allegro_init();

   set_color_depth(16);
   if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0) != 0) {
      fprintf(stderr, "failed.\n");
      return -1;
   }

   clear_to_color(screen, makecol(0,0,0));

   return 0;
}
END_OF_MAIN();

never fails, but consistently (90% of cases) gives

X Error of failed request:  BadAccess (attempt to access private resource
denied)
  Major opcode of failed request:  143 (MIT-SHM)
  Minor opcode of failed request:  1 (X_ShmAttach)
  Serial number of failed request:  33
  Current serial number in output stream:  52

Now, considering the function _xwin_destroy_screen() from src/x/xwin.c, if I
put a 'usleep(1000000);' this way

void _xwin_destroy_screen(void)
{
   usleep(1000000);
   XLOCK();
   _xwin_private_destroy_screen();
   XUNLOCK();
}

the problem goes away. But if I put it that way

void _xwin_destroy_screen(void)
{
   XLOCK();
   usleep(1000000);
   _xwin_private_destroy_screen();
   XUNLOCK();
}

the problem is back.


I don't know very well how X and threads interact, so I can't say if it's a
synchronization problem between two threads that are racing for locking the
X server or simply a problem that originates in XLOCK() itself.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/