Bug#554962: Segmentation fault in glGetError
On Sat, 2009-11-07 at 16:12 +0100, Xavier Glattard wrote:
> Package: libgl1-mesa-glx
> Version: 7.6-1_i386
>
> I'm playing with OpenGL and GNUstep (from svn) and write a small app
> based on glxgears. I just update Mesa from stable to testing. My app
> runs fine with stable packages; with testing packages, I get:
>
> xavier@mdvx-2:~/src/Gears$ openapp ./Gears
> 2009-11-07 15:40:48.829 Gears[12139] XShm pixmaps not supported by X server.
> 2009-11-07 15:40:48.829 Gears[12139] Falling back to normal XImage: s
> (will be slower).
> Erreur de segmentation
>
>
> xavier@mdvx-2:~/src/Gears$ debugapp ./Gears
> [Thread debugging using libthread_db enabled]
> [New Thread 0xb711a6e0 (LWP 12275)]
> 2009-11-07 15:40:59.802 Gears[12275] XShm pixmaps not supported by X server.
> 2009-11-07 15:40:59.803 Gears[12275] Falling back to normal XImage: s
> (will be slower).
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb711a6e0 (LWP 12275)]
> 0xb7f1d546 in glGetError () at ../../../src/mesa/x86/glapi_x86.S:415
> 415 ../../../src/mesa/x86/glapi_x86.S: No such file or directory.
> in ../../../src/mesa/x86/glapi_x86.S
> Current language: auto; currently asm
> (gdb) bt
> #0 0xb7f1d546 in glGetError () at ../../../src/mesa/x86/glapi_x86.S:415
> #1 0xb6f47eeb in -[XGGLPixelFormat drawableForWindow:] (self=0x8cc61b0,
> _cmd=0xb6f67b00, xwindowid=27263009) at XGGLFormat.m:320
> #2 0xb6f4a2d6 in -[XGGLContext setView:] (self=0x8cc7aa8, _cmd=0xb7e3c088,
> view=0x8cc4840) at XGGLContext.m:516
> #3 0xb7c99999 in -[NSOpenGLView openGLContext] (self=0x8cc4840,
> _cmd=0xb7e3c0e8) at NSOpenGLView.m:140
> #4 0xb7c997b1 in -[NSOpenGLView update] (self=0x8cc4840, _cmd=0xb7e3c108)
> at NSOpenGLView.m:208
> #5 0xb7c99e3e in -[NSOpenGLView _viewDidMoveToWindow] (self=0x8cc4840,
> _cmd=0xb7e7c3e8) at NSOpenGLView.m:270
> #6 0xb7d275ff in -[NSView addSubview:positioned:relativeTo:]
> (self=0x8c86a78,
> _cmd=0xb7e7c4e8, aView=0x8cc4840, place=NSWindowAbove, otherView=0x0)
> at NSView.m:758
> #7 0xb7d2380f in -[NSView addSubview:] (self=0x8c86a78, _cmd=0x8054710,
> aView=0x8cc4840) at NSView.m:696
> #8 0x0804c176 in -[GearsWindow
> initWithContentRect:styleMask:backing:defer:]
> () at GearsWindow.m:243
> #9 0x0804c4f4 in -[GearsWindow initWithBacking:] (self=0x8c873c8,
> _cmd=0x80530e0, bufferingType=NSBackingStoreBuffered) at
> GearsWindow.m:282
> #10 0x0804a167 in -[GearsMain createWindowWithBacking:] (self=0x8b20578,
> _cmd=0x80530f8, backing=NSBackingStoreBuffered) at GearsMain.m:94
> #11 0x0804a200 in -[GearsMain applicationDidFinishLaunching:]
> (self=0x8b20578,
> ---Type <return> to continue, or q <return> to quit---q
>
> The original glxgear runs fine.
>
>
> The GNUstep code (in XGGLPixelFormat.m) is:
>
> - (GLXWindow) drawableForWindow: (Window)xwindowid
> {
> GLint error;
> GLXWindow win;
> MAKE_DISPLAY(dpy);
>
> if (GSglxMinorVersion(dpy) >= 3)
> {
> win = glXCreateWindow(dpy, configurations.fbconfig[0],
> xwindowid, NULL);
> }
> else
> {
> win = xwindowid;
> }
>
> error = glGetError();
> if ( error != GL_NO_ERROR )
> NSDebugMLLog( @"GLX", @"Can not create GL window for pixel format
> %@ - Errror %u",
> self, error );
> return win;
> }
This code looks buggy: All GL functions including glGetError require a
(GLX in this case) context to be bound (otherwise IIRC the OpenGL spec
says behaviour is undefined). glGetError() isn't meaningful for GLX
functions like glXCreateWindow() anyway.
--
Earthling Michel Dänzer | http://www.vmware.com
Libre software enthusiast | Debian, X and DRI developer
Reply to: