[PATCH 2/2] winex11: fix free of colormap

Miklós Máté mtmkls at gmail.com
Sat Jun 18 04:48:57 CDT 2016


Now that the cleanup of gl drawable is fixed, the colormap is freed, but
in the default code path (no xcomposite) it's not created. I found that
gl->colormap is not used anywhere, so I decided to remove it.

With this, Indiana Jones and The Emperor's Tomb can start again, and hit
the "invalid floating point camera matrix" error later.

Signed-off-by: Miklós Máté <mtmkls at gmail.com>
---
 dlls/winex11.drv/opengl.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index cf74f96..a452837 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -257,7 +257,6 @@ struct gl_drawable
     GLXDrawable                    drawable;     /* drawable for rendering with GL */
     Window                         window;       /* window if drawable is a GLXWindow */
     Pixmap                         pixmap;       /* base pixmap if drawable is a GLXPixmap */
-    Colormap                       colormap;     /* colormap used for the drawable */
     const struct wgl_pixel_format *format;       /* pixel format for the drawable */
     XVisualInfo                   *visual;       /* information about the GL visual */
     RECT                           rect;         /* drawable rect, relative to whole window drawable */
@@ -1317,7 +1316,6 @@ static void free_gl_drawable( struct gl_drawable *gl )
     case DC_GL_CHILD_WIN:
         pglXDestroyWindow( gdi_display, gl->drawable );
         XDestroyWindow( gdi_display, gl->window );
-        XFreeColormap( gdi_display, gl->colormap );
         break;
     case DC_GL_PIXMAP_WIN:
         pglXDestroyPixmap( gdi_display, gl->drawable );
@@ -1356,6 +1354,7 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
     {
         static Window dummy_parent;
         XSetWindowAttributes attrib;
+        Colormap colormap;
 
         attrib.override_redirect = True;
         if (!dummy_parent)
@@ -1364,12 +1363,12 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
                                          InputOutput, default_visual.visual, CWOverrideRedirect, &attrib );
             XMapWindow( gdi_display, dummy_parent );
         }
-        gl->colormap = XCreateColormap(gdi_display, dummy_parent, gl->visual->visual,
+        colormap = XCreateColormap(gdi_display, dummy_parent, gl->visual->visual,
                                        (gl->visual->class == PseudoColor ||
                                         gl->visual->class == GrayScale ||
                                         gl->visual->class == DirectColor) ?
                                        AllocAll : AllocNone);
-        attrib.colormap = gl->colormap;
+        attrib.colormap = colormap;
         XInstallColormap(gdi_display, attrib.colormap);
 
         gl->type = DC_GL_CHILD_WIN;
@@ -1386,7 +1385,7 @@ static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl )
                 XMapWindow(gdi_display, gl->window);
             }
         }
-        else XFreeColormap( gdi_display, gl->colormap );
+        else XFreeColormap( gdi_display, colormap );
     }
 #endif
     else
@@ -1580,7 +1579,6 @@ void set_gl_drawable_parent( HWND hwnd, HWND parent )
         if (parent != GetDesktopWindow()) goto done;
         pglXDestroyWindow( gdi_display, gl->drawable );
         XDestroyWindow( gdi_display, gl->window );
-        XFreeColormap( gdi_display, gl->colormap );
         break;
     case DC_GL_PIXMAP_WIN:
         if (parent != GetDesktopWindow()) goto done;
-- 
2.8.1




More information about the wine-patches mailing list