Rico Schüller : gdi32: Check the current context in wglMakeCurrent().

Alexandre Julliard julliard at winehq.org
Tue Sep 22 13:56:30 CDT 2009


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Sat Sep 19 15:52:36 2009 +0200

gdi32: Check the current context in wglMakeCurrent().

---

 dlls/gdi32/opengl.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c
index 204fc2b..63ba433 100644
--- a/dlls/gdi32/opengl.c
+++ b/dlls/gdi32/opengl.c
@@ -193,7 +193,15 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
     /* When the context hglrc is NULL, the HDC is ignored and can be NULL.
      * In that case use the global hDC to get access to the driver.  */
     if(hglrc == NULL)
+    {
+        if( hdc == NULL && !wglGetCurrentContext() )
+        {
+            WARN( "Current context is NULL\n");
+            SetLastError( ERROR_INVALID_HANDLE );
+            return FALSE;
+        }
         dc = OPENGL_GetDefaultDC();
+    }
     else
         dc = get_dc_ptr( hdc );
 




More information about the wine-cvs mailing list