DDRAW: don't leak visuals
Saulius Krasuckas
saulius2 at ar.fi.lt
Sun Aug 21 15:34:15 CDT 2005
* On Sun, 21 Aug 2005, Saulius Krasuckas wrote:
>
> This is my first X-perience. Does this look OK, folks?
Proabably I should post a diff with a larger context to get an answer.
Sorry.
Index: dlls/ddraw/device_opengl.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/device_opengl.c,v
retrieving revision 1.7
diff -p -u -1 -0 -r1.7 device_opengl.c
--- dlls/ddraw/device_opengl.c 11 Aug 2005 10:57:47 -0000 1.7
+++ dlls/ddraw/device_opengl.c 21 Aug 2005 20:34:03 -0000
@@ -4337,26 +4337,28 @@ d3ddevice_init_at_startup(void *gl_handl
template.visualid = XVisualIDFromVisual(visual);
vis = XGetVisualInfo(display, VisualIDMask, &template, &num);
if (vis == NULL) {
LEAVE_GL();
WARN("Error creating visual info for capabilities initialization - D3D support disabled !\n");
return FALSE;
}
gl_context = glXCreateContext(display, vis, NULL, GL_TRUE);
if (gl_context == NULL) {
+ XFree(vis);
LEAVE_GL();
WARN("Error creating default context for capabilities initialization - D3D support disabled !\n");
return FALSE;
}
if (glXMakeCurrent(display, drawable, gl_context) == False) {
glXDestroyContext(display, gl_context);
+ XFree(vis);
LEAVE_GL();
WARN("Error setting default context as current for capabilities initialization - D3D support disabled !\n");
return FALSE;
}
/* Then, query all extensions */
glXExtensions = glXQueryExtensionsString(display, DefaultScreen(display)); /* Note: not used right now but will for PBuffers */
glExtensions = (const char *) glGetString(GL_EXTENSIONS);
glVersion = (const char *) glGetString(GL_VERSION);
if (gl_handle != NULL) {
@@ -4428,14 +4430,15 @@ d3ddevice_init_at_startup(void *gl_handl
GL_extensions.glCompressedTexSubImage2D = pglXGetProcAddressARB( (const GLubyte *) "glCompressedTexSubImage2DARB");
}
}
/* Fill the D3D capabilities according to what GL tells us... */
fill_caps();
/* And frees this now-useless context */
glXMakeCurrent(display, None, NULL);
glXDestroyContext(display, gl_context);
+ XFree(vis);
LEAVE_GL();
return TRUE;
}
More information about the wine-devel
mailing list