From: Michel Dänzer <[email protected]>

This can fail, e.g. when XLIB_SKIP_ARGB_VISUALS=1 is set.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524794 and
http://bugs.freedesktop.org/show_bug.cgi?id=21600 .
---
 src/glx/x11/glxcmds.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index b9e0706..15c8ca8 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -1324,7 +1324,20 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int 
screen, int *attribList)
        if ( fbconfigs_compatible( & test_config, modes )
             && ((best_config == NULL)
                 || (fbconfig_compare( (const __GLcontextModes * const * 
const)&modes, &best_config ) < 0)) ) {
-           best_config = modes;
+           XVisualInfo visualTemplate;
+           XVisualInfo *newList;
+           int  i;
+
+           visualTemplate.screen = screen;
+           visualTemplate.visualid = modes->visualID;
+           newList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
+                                     &visualTemplate, &i );
+
+           if (newList) {
+               Xfree(visualList);
+               visualList = newList;
+               best_config = modes;
+           }
        }
     }
 
@@ -1334,13 +1347,6 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int 
screen, int *attribList)
     ** and return this.
     */
     if (best_config != NULL) {
-       XVisualInfo visualTemplate;
-       int  i;
-
-       visualTemplate.screen = screen;
-       visualTemplate.visualid = best_config->visualID;
-       visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
-                                    &visualTemplate, &i );
     }
 
     return visualList;
-- 
1.6.2.4


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to