Re: [AD] Five patches

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


On 31 Oct 2001, Peter Wang <tjaden@xxxxxxxxxx> wrote:
> > In the function _xwin_sysdrv_exit, _unix_bg_man->exit() is called *before*
> > _xwin_destroy_window and _xwin_close_display, which both use _unix_bg_man
> > inside the macros XLOCK and XUNLOCK.
> 
> Thanks, changed in CVS.

But that exposed another bug, where XUnlockDisplay() would be called
after XCloseDisplay().  This patch was committed, but I think there's
still a problem somewhere.


diff -u -r1.34 xwin.c
--- xwin.c      2001/10/27 00:19:49     1.34
+++ xwin.c      2001/10/31 23:33:59
@@ -159,7 +159,6 @@
 static char *_xwin_safe_copy(char *dst, const char *src, int len);
 
 static int _xwin_private_open_display(char *name);
-static void _xwin_private_close_display(void);
 static int _xwin_private_create_window(void);
 static void _xwin_private_destroy_window(void);
 static void _xwin_private_select_screen_to_buffer_function(void);
@@ -325,21 +324,20 @@
 /* _xwin_close_display:
  *  Wrapper for XCloseDisplay.
  */
-static void _xwin_private_close_display(void)
+void _xwin_close_display(void)
 {
+   XLOCK();
+
    _xwin_private_destroy_window();
 
    if (_xwin.display != 0) {
+      /* Must unlock display before closing.  */
+      XUNLOCK();
       XCloseDisplay(_xwin.display);
       _xwin.display = 0;
    }
-}
-
-void _xwin_close_display(void)
-{
-   XLOCK();
-   _xwin_private_close_display();
-   XUNLOCK();
+   else
+      XUNLOCK();
 }
 



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