Fix for glXCreate{Pixmap,Window}
Ian Romanick
idr at us.ibm.com
Thu Jan 13 12:13:04 PST 2005
Soeren Sandmann wrote:
> Index: lib/GL/glx/glx_pbuffer.c
> ===================================================================
> RCS file: /cvs/xorg/xc/lib/GL/glx/glx_pbuffer.c,v
> retrieving revision 1.2
> diff -u -p -u -r1.2 glx_pbuffer.c
> --- lib/GL/glx/glx_pbuffer.c 28 Jun 2004 18:08:26 -0000 1.2
> +++ lib/GL/glx/glx_pbuffer.c 13 Jan 2005 18:58:02 -0000
> @@ -280,8 +280,10 @@ CreateDrawable( Display *dpy, const __GL
> unsigned int i;
>
>
> - for ( i = 0 ; attrib_list[i * 2] != None ; i++ )
> - /* empty */ ;
> + if (attrib_list) {
> + for ( i = 0 ; attrib_list[i * 2] != None ; i++ )
> + /* empty */ ;
> + }
The only problem here is that i is left uninitialized if attrib_list ==
NULL. That's easy enough to fix, though.
>
> LockDisplay(dpy);
> GetReqExtra( GLXCreateWindow, 20 + (8 * i), req );
> @@ -292,12 +294,13 @@ CreateDrawable( Display *dpy, const __GL
> req->screen = (CARD32) fbconfig->screen;
> req->fbconfig = fbconfig->fbconfigID;
> req->window = (GLXPbuffer) drawable;
> + req->glxwindow = (GLXWindow) XAllocID(dpy);
Good catch.
> req->numAttribs = (CARD32) i;
Even though there are no attributes defined (i.e., i will always be
zero), there should be code here to copy attrib_list to data. Looks
like I missed that when I wrote the code. Oops.
> UnlockDisplay(dpy);
> SyncHandle();
>
> - return drawable;
> + return (GLXDrawable)req->glxwindow;
> }
When you commit this, could you also commit it to Mesa? src/glx/x11 is
now the "authoritative" source for libGL.so.
More information about the xorg
mailing list