[Mesa-dev] glxcurrent.c question SEGFAULT question
Brian Paul
brian.e.paul at gmail.com
Wed Mar 9 08:00:43 PST 2011
On Wed, Mar 9, 2011 at 8:09 AM, John Doe <umebugmenot at gmail.com> wrote:
> 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,
Can you try the attached patch?
-Brian
-------------- next part --------------
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 9a64990..2e8e979 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -198,7 +198,7 @@ __glXGenerateError(Display * dpy, struct glx_context *gc, XID resource,
error.resourceID = resource;
error.sequenceNumber = dpy->request;
error.type = X_Error;
- error.majorCode = gc->majorOpcode;
+ error.majorCode = __glXSetupForCommand(dpy);
error.minorCode = minorCode;
_XError(dpy, &error);
}
More information about the mesa-dev
mailing list