mesa garbage collection - pardon the silly questions...

"leon zadorin" <[email protected]>
Newsgroups gmane.comp.xfree86.devel
Message-ID <[email protected]>
Hi all,

I am in a process of investigating some strange app's behaviour, where having
1) opened display connecton
2) initialised glx
3) attached window to glx and made the glx context current, etc.
4) then de-initialised glx, destroyed window, closed display
connecton, etc. etc.
5) then opened display connection again
6) then trying to initialise glx crashes (at glx creating a context)
on NetBSD-current/macppc port...

I have traced the crash to XSync call in mesa garbage colleciton...
anyway... in a process of my learning (so pardon if my questions ar
rather silly) the whole X thing :-) I have a question about the
following code in:

xc/extras/Mesa/src/mesa/drivers/x11/xm_api.c
or http://cvsweb.xfree86.org/cvsweb/xc/extras/Mesa/src/mesa/drivers/x11/xm_api.c?rev=HEAD&content-type=text/vnd.viewcvs-markup

void XMesaGarbageCollect( void )
{
   XMesaBuffer b, next;
   for (b=XMesaBufferList; b; b=next) {
      next = b->Next;
      if (b->display && b->frontbuffer && b->type == WINDOW) {
#ifdef XFree86Server
	 /* NOT_NEEDED */
#else
         XSync(b->display, False);
         if (!window_exists( b->display, b->frontbuffer )) {
            /* found a dead window, free the ancillary info */
            XMesaDestroyBuffer( b );
         }
#endif
      }
   }
}

The above code checks for vaild (non-null) "display" and "frontbuffer"
before calling Xsync... but how does it know that "b->display" is
still in the open state (i.e. that XCloseDisplay was not called on
"b->display")... or is it guaranteed by some other code that
XMesaBufferList will only have open displays... or is it OK to call
XSync on a closed display?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.