Re: [AD] X shutdown sequence |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 20 Nov 2001, George Foot <gfoot@xxxxxxxxxx> wrote:
> On Tue, Nov 20, 2001 at 01:10:18PM +1100, Peter Wang wrote:
> > + /* Oh gawd, what is that smell? */
> > + int locking = 1;
> > +#ifdef HAVE_LIBPTHREAD
> > + if (_unix_bg_man == &_bg_man_pthreads)
> > + locking = 0;
> > +#endif
>
> Isn't this equivalent to testing _unix_bg_man->multi_threaded?
> That's what it's there for. :)
I knew it was too stinky to be true :-) Here's a better patch.
Index: src/x/xsystem.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xsystem.c,v
retrieving revision 1.18
diff -u -r1.18 xsystem.c
--- src/x/xsystem.c 2001/11/06 17:16:41 1.18
+++ src/x/xsystem.c 2001/11/20 23:51:32
@@ -213,7 +213,6 @@
*/
static void _xwin_sysdrv_exit(void)
{
- _xwin_destroy_window();
_xwin_close_display();
_unix_bg_man->exit();
Index: src/x/xwin.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xwin.c,v
retrieving revision 1.38
diff -u -r1.38 xwin.c
--- src/x/xwin.c 2001/11/09 09:48:32 1.38
+++ src/x/xwin.c 2001/11/20 23:51:38
@@ -326,18 +326,19 @@
*/
void _xwin_close_display(void)
{
- XLOCK();
-
- _xwin_private_destroy_window();
+ if (!_unix_bg_man->multi_threaded) {
+ XLOCK();
+ }
if (_xwin.display != 0) {
- /* Must unlock display before closing. */
- XUNLOCK();
+ _xwin_destroy_window();
XCloseDisplay(_xwin.display);
_xwin.display = 0;
}
- else
+
+ if (!_unix_bg_man->multi_threaded) {
XUNLOCK();
+ }
}