[PATCH] FreeGLUT causes segfault in recent Xorg GL driver

Florian Echtler floe at butterbrot.org
Mon Nov 10 01:31:29 PST 2008


Hi everyone,

I've just switched to a recent Xorg build (git checkout from last
Friday). I'm using the radeon driver on a Radeon Mobility X1400, and
GLUT-based applications run with 3D acceleration when I start them with
the GLUT implementation from MESA. However, when I try freeglut rev. 749
instead (just by replacing the libraries), the following happens:

Program received signal SIGSEGV, Segmentation fault.
...
(gdb) bt
#0  0xb61df5a2 in driBindContext (context=0xb390ff40, draw=0x0, 
  read=0x0) at dri_glx.c:457
#1  0xb61be38a in MakeContextCurrent (dpy=0x83d8438, draw=54525954, 
  read=54525954, gc=0xb3903530, pre13=0) at glxcurrent.c:391
#2  0xb534ead2 in fgOpenWindow () from /usr/lib/libglut.so.3
#3  0xb534ce05 in fgCreateWindow () from /usr/lib/libglut.so.3
#4  0xb534e1fa in glutCreateWindow () from /usr/lib/libglut.so.3
...
(gdb) 

Same backtrace occurs with a freshly compiled Freeglut test program.

I managed to fix this bug with the following one-line patch:

--- src/freeglut_window.c	(Revision 749)
+++ src/freeglut_window.c	(Arbeitskopie)
@@ -759,10 +759,9 @@
     XSetWMProtocols( fgDisplay.Display, window->Window.Handle,
                      &fgDisplay.DeleteWindow, 1 );
 
-    glXMakeContextCurrent(
+    glXMakeCurrent(
         fgDisplay.Display,
         window->Window.Handle,
-        window->Window.Handle,
         window->Window.Context
     );
 
Unfortunately, I don't know a) which side effects this might have (from 
looking at the macro, it seems that there shouldn't be any) and b) I'm 
also unsure whether this patch is appropriate for older X releases.

So I'd be glad if some of you could have a quick look whether this is 
really a fix or rather just an ugly workaround.

Many thanks,
Yours, Florian
-- 
0666 - Filemode of the Beast




More information about the xorg mailing list