[ros-diffs] [tkreuzer] 30914: fix some bugs

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Nov 30 05:12:24 CET 2007


Author: tkreuzer
Date: Fri Nov 30 07:12:23 2007
New Revision: 30914

URL: http://svn.reactos.org/svn/reactos?rev=30914&view=rev
Log:
fix some bugs

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/dc.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dc.c?rev=30914&r1=30913&r2=30914&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Fri Nov 30 07:12:23 2007
@@ -2055,6 +2055,9 @@
     PBITMAPOBJ pBmp;
     HRGN hVisRgn;
     BOOLEAN bFailed;
+    PGDIBRUSHOBJ pBrush;
+
+    if (hDC == NULL || hBmp == NULL) return NULL;
 
     pDC = DC_LockDc(hDC);
     if (!pDC)
@@ -2096,11 +2099,27 @@
     }
 
     /* Regenerate the XLATEOBJs. */
-    EngDeleteXlate(pDC->XlateBrush);
-    pDC->XlateBrush = IntGdiCreateBrushXlate(pDC, pDc_Attr->hbrush, &bFailed);
-
-    EngDeleteXlate(pDC->XlatePen);
-    pDC->XlatePen = IntGdiCreateBrushXlate(pDC, pDc_Attr->hpen, &bFailed);
+    pBrush = BRUSHOBJ_LockBrush(pDc_Attr->hbrush);
+    if (pBrush)
+    {
+        if (pDC->XlateBrush)
+        {
+            EngDeleteXlate(pDC->XlateBrush);
+        }
+        pDC->XlateBrush = IntGdiCreateBrushXlate(pDC, pBrush, &bFailed);
+        BRUSHOBJ_UnlockBrush(pBrush);
+    }
+
+    pBrush = PENOBJ_LockPen(pDc_Attr->hpen);
+    if (pBrush)
+    {
+        if (pDC->XlatePen)
+        {
+            EngDeleteXlate(pDC->XlatePen);
+        }
+        pDC->XlatePen = IntGdiCreateBrushXlate(pDC, pBrush, &bFailed);
+        PENOBJ_UnlockPen(pBrush);
+    }
 
     DC_UnlockDc(pDC);
 
@@ -2128,6 +2147,8 @@
     XLATEOBJ *XlateObj;
     BOOLEAN bFailed;
 
+    if (hDC == NULL || hBrush == NULL) return NULL;
+
     pDC = DC_LockDc(hDC);
     if (!pDC)
     {
@@ -2176,6 +2197,8 @@
     PDC_ATTR pDc_Attr;
     HFONT hOrgFont = NULL;
 
+    if (hDC == NULL || hFont == NULL) return NULL;
+
     pDC = DC_LockDc(hDC);
     if (!pDC)
     {
@@ -2212,6 +2235,8 @@
     PGDIBRUSHOBJ pPen;
     XLATEOBJ *XlateObj;
     BOOLEAN bFailed;
+
+    if (hDC == NULL || hPen == NULL) return NULL;
 
     pDC = DC_LockDc(hDC);
     if (!pDC)




More information about the Ros-diffs mailing list