[Mesa-dev] glxcurrent.c question SEGFAULT question

John Doe umebugmenot at gmail.com
Wed Mar 9 07:09:56 PST 2011

Hi all,

I have posted this question on the users list also but figured this
should be the right place to ask.
Apologies if this cross-posting is considered a bad etiquette. Here it goes:

While working with a third party application I received a SEGFAULT.
Using backtrace I was able to home in the apparent (might not be the
main) source of the SEGFAULT. It is in glxcurrent.c.
More specifically, it is generated at line 201:

static void
__glXGenerateError(Display * dpy, struct glx_context *gc, XID resource,
                   BYTE errorCode, CARD16 minorCode)
   xError error;

   error.errorCode = errorCode;
   error.resourceID = resource;
   error.sequenceNumber = dpy->request;
   error.type = X_Error;
   error.majorCode = gc->majorOpcode;       <---- Line 201
   error.minorCode = minorCode;
   _XError(dpy, &error);

The previous stack call is in the same file at line 228:

if (gc == NULL && (draw != None || read != None)) {
      __glXGenerateError(dpy, gc, (draw != None) ? draw : read,   <-- Line 228
                         BadMatch, X_GLXMakeContextCurrent);
      return False;

Examining the trace I was able to see that all the conditions for the
if-test were satisfied. Hence the program counter enters the if-block
and calls the __glXGenerateError.
But, in __glXGenerateError since the gc is NULL the call:

error.majorCode = gc->majorOpcode

causes SEGFAULT.

Is this a bug? Or am I missing something?

I am on a 32-bit Ubuntu Maverick box. MESA version is 7.9.2.

Thank you,


More information about the mesa-dev mailing list