Henri Verbeet : wined3d: Always check the result of wglMakeCurrent().

Alexandre Julliard julliard at winehq.org
Mon Jun 29 09:17:44 CDT 2009


Module: wine
Branch: master
Commit: f57967c9838d6610b236a54777aeb8c268d2838b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f57967c9838d6610b236a54777aeb8c268d2838b

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Jun 29 10:11:24 2009 +0200

wined3d: Always check the result of wglMakeCurrent().

---

 dlls/wined3d/context.c |   11 +++++++++--
 dlls/wined3d/directx.c |    7 +++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index d8cc876..6be40c7 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1073,7 +1073,10 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
      * but enable it for the first context we create, and reenable it on the old context
      */
     if(oldDrawable && oldCtx) {
-        pwglMakeCurrent(oldDrawable, oldCtx);
+        if (!pwglMakeCurrent(oldDrawable, oldCtx))
+        {
+            ERR("Failed to make previous GL context %p current.\n", oldCtx);
+        }
     } else {
         last_device = This;
     }
@@ -1201,7 +1204,11 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
     }
 
     /* Cleanup the GL context */
-    pwglMakeCurrent(NULL, NULL);
+    if (!pwglMakeCurrent(NULL, NULL))
+    {
+        ERR("Failed to disable GL context.\n");
+    }
+
     if(context->isPBuffer) {
         GL_EXTCALL(wglReleasePbufferDCARB(context->pbuffer, context->hdc));
         GL_EXTCALL(wglDestroyPbufferARB(context->pbuffer));
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 2678285..1512a31 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -230,7 +230,10 @@ static void WineD3D_ReleaseFakeGLContext(void) {
     if (0 == (--wined3d_fake_gl_context_ref) ) {
         if(!wined3d_fake_gl_context_foreign && glCtx) {
             TRACE_(d3d_caps)("destroying fake GL context\n");
-            pwglMakeCurrent(NULL, NULL);
+            if (!pwglMakeCurrent(NULL, NULL))
+            {
+                ERR("Failed to disable fake GL context.\n");
+            }
             pwglDeleteContext(glCtx);
         }
         if(wined3d_fake_gl_context_hdc)
@@ -301,7 +304,7 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
 
         /* Make it the current GL context */
         if (!pwglMakeCurrent(wined3d_fake_gl_context_hdc, glCtx)) {
-            WARN_(d3d_caps)("Error setting default context as current for capabilities initialization\n");
+            ERR_(d3d_caps)("Failed to make fake GL context current.\n");
             goto fail;
         }
     }




More information about the wine-cvs mailing list