[PATCH] Hack to delete already created destination context in wglShareLists()

Jim Cameron jim_24601 at btinternet.com
Wed Aug 27 16:21:13 CDT 2008


---
 dlls/winex11.drv/opengl.c |   56 ++++++++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index a68591d..15e3043 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1861,34 +1861,34 @@ BOOL X11DRV_wglShareLists(HGLRC hglrc1, HGLRC hglrc2) {
     if (!has_opengl()) return FALSE;
 
     if (NULL != dest && dest->ctx != NULL) {
-        ERR("Could not share display lists, context already created !\n");
-        return FALSE;
-    } else {
-        if (org->ctx == NULL) {
-            int indirect = (GetObjectType(org->hdc) == OBJ_MEMDC);
-            wine_tsx11_lock();
-            describeContext(org);
-
-            if(org->vis)
-                org->ctx = pglXCreateContext(gdi_display, org->vis, NULL, !indirect);
-            else /* Create a GLX Context for a pbuffer */
-                org->ctx = pglXCreateNewContext(gdi_display, org->fmt->fbconfig, org->fmt->render_type, NULL, True);
-            wine_tsx11_unlock();
-            TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org);
-        }
-        if (NULL != dest) {
-            int indirect = (GetObjectType(dest->hdc) == OBJ_MEMDC);
-            wine_tsx11_lock();
-            describeContext(dest);
-            /* Create the destination context with display lists shared */
-            if(dest->vis)
-                dest->ctx = pglXCreateContext(gdi_display, dest->vis, org->ctx, !indirect);
-            else /* Create a GLX Context for a pbuffer */
-                dest->ctx = pglXCreateNewContext(gdi_display, dest->fmt->fbconfig, dest->fmt->render_type, org->ctx, True);
-            wine_tsx11_unlock();
-            TRACE(" created a delayed OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx);
-            return TRUE;
-        }
+        WARN("Destination context already created, destroying it\n");
+        pglXDestroyContext(gdi_display, dest->ctx);
+	dest->ctx = NULL;
+    }
+    if (org->ctx == NULL) {
+        int indirect = (GetObjectType(org->hdc) == OBJ_MEMDC);
+	wine_tsx11_lock();
+	describeContext(org);
+
+	if(org->vis)
+	    org->ctx = pglXCreateContext(gdi_display, org->vis, NULL, !indirect);
+	else /* Create a GLX Context for a pbuffer */
+	    org->ctx = pglXCreateNewContext(gdi_display, org->fmt->fbconfig, org->fmt->render_type, NULL, True);
+	wine_tsx11_unlock();
+	TRACE(" created a delayed OpenGL context (%p) for Wine context %p\n", org->ctx, org);
+    }
+    if (NULL != dest) {
+        int indirect = (GetObjectType(dest->hdc) == OBJ_MEMDC);
+	wine_tsx11_lock();
+	describeContext(dest);
+	/* Create the destination context with display lists shared */
+	if(dest->vis)
+	    dest->ctx = pglXCreateContext(gdi_display, dest->vis, org->ctx, !indirect);
+	else /* Create a GLX Context for a pbuffer */
+	    dest->ctx = pglXCreateNewContext(gdi_display, dest->fmt->fbconfig, dest->fmt->render_type, org->ctx, True);
+	wine_tsx11_unlock();
+	TRACE(" created a delayed OpenGL context (%p) for Wine context %p sharing lists with OpenGL ctx %p\n", dest->ctx, dest, org->ctx);
+	return TRUE;
     }
     return FALSE;
 }
-- 
1.5.4.3


--0-2137544215-1219872698=:14245--



More information about the wine-patches mailing list