Hmm, if you modify testgl.c to run its OpenGL subsystem twice, I get a
lock in XSync(). This is the strack trace:
Program received signal SIGINT, Interrupt.
0x405bac98 in _XFlushInt ()
(gdb) where
#0 0x405bac98 in _XFlushInt ()
#1 0x405bac4b in _XFlush ()
#2 0x405b7d5a in XSync ()
#3 0x401a89aa in XMesaGarbageCollect () at xmesa1.c:2442
#4 0x4026b699 in X11_CreateWindow (this=0x804a6f0, screen=0x804ce90,
w=640,
h=480, flags=2) at SDL_x11video.c:536
#5 0x4026bb03 in X11_SetVideoMode (this=0x804a6f0, current=0x804ce90,
width=640, height=480, bpp=16, flags=2) at SDL_x11video.c:689
#6 0x40267793 in SDL_SetVideoMode (width=640, height=480, bpp=16,
flags=2)
at SDL_video.c:492
#7 0x8048df7 in RunOpenGL (argc=1, argv=0xbffffa74) at testgl2.c:85
#8 0x8049209 in main (argc=1, argv=0xbffffa74) at testgl2.c:209
#9 0x402efcb3 in __libc_start_main (main=0x80491dc , argc=1,
argv=0xbffffa74, init=0x804896c <_init>, fini=0x804923c <_fini>,
rtld_fini=0x4000a350 <_dl_fini>, stack_end=0xbffffa6c)
at …/sysdeps/generic/libc-start.c:78
(gdb)
It’s actually locking in the call to glXCreateContext().
The important thing to note is that between #3 and #4 there is no
X11_GL_CreateWindow() and no glXCreateContext( ), as there should
be. Furthermore, there should also be a Fake_glXCreateContext() call,
because that’s where XMesaGarbageCollect() is called from. Hmm…
I’ve added a call to glXMakeCurrent( GFX_Display, NULL, NULL ) in
X11_VideoQuit(), but that was wishful thinking on my part.
Any thoughts from gurus out there? It looks like we clean up state
pretty well… although I notice we never do anything with the
XVisualInfo* returned from glXChooseVisual(). Are we responsible for
releasing that somehow?
m.–
Programmer "I wrote a song about dental floss,
Loki Entertainment Software but did anyone’s teeth get cleaner?"
http://lokigames.com/~briareos/ - Frank Zappa, re: the PMRC