Evan Stade : gdi32: Don't access DC in PolyDraw after releasing handle.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jul 4 06:56:51 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Tue Jul  3 19:06:34 2007 -0700

gdi32: Don't access DC in PolyDraw after releasing handle.

---

 dlls/gdi32/painting.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 1b30d6d..3e84f60 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -833,18 +833,18 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
     if(dc->funcs->pPolyDraw)
     {
         result = dc->funcs->pPolyDraw( dc->physDev, lppt, lpbTypes, cCount );
-        GDI_ReleaseObj( hdc );
-        return result;
+        goto end;
     }
-    GDI_ReleaseObj( hdc );
 
     /* check for each bezierto if there are two more points */
     for( i = 0; i < cCount; i++ )
 	if( lpbTypes[i] != PT_MOVETO &&
 	    lpbTypes[i] & PT_BEZIERTO )
 	{
-	    if( cCount < i+3 )
-		return FALSE;
+	    if( cCount < i+3 ){
+		result = FALSE;
+                goto end;
+            }
 	    else
 		i += 2;
 	}
@@ -869,8 +869,10 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
 	    PolyBezierTo( hdc, &lppt[i], 3 );
 	    i += 2;
 	}
-	else
-	    return FALSE;
+	else{
+	    result = FALSE;
+            goto end;
+        }
 
 	if( lpbTypes[i] & PT_CLOSEFIGURE )
 	{
@@ -881,7 +883,10 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
 	}
     }
 
-    return TRUE;
+    result = TRUE;
+end:
+    GDI_ReleaseObj( hdc );
+    return result;
 }
 
 




More information about the wine-cvs mailing list