[ros-diffs] [jgardou] 46507: [WIN32K] Each DC_lockDc call should be followed by a DC_UnlockDc, even on error path.

jgardou at svn.reactos.org jgardou at svn.reactos.org
Sun Mar 28 00:58:09 CET 2010


Author: jgardou
Date: Sun Mar 28 00:58:09 2010
New Revision: 46507

URL: http://svn.reactos.org/svn/reactos?rev=46507&view=rev
Log:
[WIN32K]
Each DC_lockDc call should be followed by a DC_UnlockDc, even on error path.

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
    branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c?rev=46507&r1=46506&r2=46507&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Sun Mar 28 00:58:09 2010
@@ -384,6 +384,7 @@
     INT Index;
     PGDI_TABLE_ENTRY Entry;
     PDC pDC;
+    BOOL ret;
 
     /* FIXME: This function has broken error handling */
 
@@ -405,40 +406,43 @@
           These regions do not use attribute sections and when allocated, use
           gdiobj level functions.
     */
-        if (pDC->rosdc.hClipRgn)
-        {   // FIXME! HAX!!!
-            Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hClipRgn);
-            Entry = &GdiHandleTable->Entries[Index];
-            if (Entry->UserData) FreeObjectAttr(Entry->UserData);
-            Entry->UserData = NULL;
-            //
-            if (!GDIOBJ_SetOwnership(pDC->rosdc.hClipRgn, Owner)) return FALSE;
-        }
-        if (pDC->prgnVis)
-        {   // FIXME! HAX!!!
-            Index = GDI_HANDLE_GET_INDEX(((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr);
-            Entry = &GdiHandleTable->Entries[Index];
-            if (Entry->UserData) FreeObjectAttr(Entry->UserData);
-            Entry->UserData = NULL;
-            //
-            if (!GDIOBJ_SetOwnership(((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr, Owner)) return FALSE;
-        }
-        if (pDC->rosdc.hGCClipRgn)
-        {   // FIXME! HAX!!!
-            Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hGCClipRgn);
-            Entry = &GdiHandleTable->Entries[Index];
-            if (Entry->UserData) FreeObjectAttr(Entry->UserData);
-            Entry->UserData = NULL;
-            //
-            if (!GDIOBJ_SetOwnership(pDC->rosdc.hGCClipRgn, Owner)) return FALSE;
-        }
-        if (pDC->dclevel.hPath)
-        {
-            if (!GDIOBJ_SetOwnership(pDC->dclevel.hPath, Owner)) return FALSE;
-        }
-        DC_UnlockDc(pDC);
-
-    return TRUE;
+    if (pDC->rosdc.hClipRgn)
+    {   // FIXME! HAX!!!
+        Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hClipRgn);
+        Entry = &GdiHandleTable->Entries[Index];
+        if (Entry->UserData) FreeObjectAttr(Entry->UserData);
+        Entry->UserData = NULL;
+        //
+        if (!GDIOBJ_SetOwnership(pDC->rosdc.hClipRgn, Owner)) goto leave;
+    }
+    if (pDC->prgnVis)
+    {   // FIXME! HAX!!!
+        Index = GDI_HANDLE_GET_INDEX(((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr);
+        Entry = &GdiHandleTable->Entries[Index];
+        if (Entry->UserData) FreeObjectAttr(Entry->UserData);
+        Entry->UserData = NULL;
+        //
+        if (!GDIOBJ_SetOwnership(((PROSRGNDATA)pDC->prgnVis)->BaseObject.hHmgr, Owner)) goto leave;
+    }
+    if (pDC->rosdc.hGCClipRgn)
+    {   // FIXME! HAX!!!
+        Index = GDI_HANDLE_GET_INDEX(pDC->rosdc.hGCClipRgn);
+        Entry = &GdiHandleTable->Entries[Index];
+        if (Entry->UserData) FreeObjectAttr(Entry->UserData);
+        Entry->UserData = NULL;
+        //
+        if (!GDIOBJ_SetOwnership(pDC->rosdc.hGCClipRgn, Owner)) goto leave;
+    }
+    if (pDC->dclevel.hPath)
+    {
+        if (!GDIOBJ_SetOwnership(pDC->dclevel.hPath, Owner)) goto leave;
+    }
+    ret = TRUE;
+
+leave:
+    DC_UnlockDc(pDC);
+
+    return ret;
 }
 
 HDC

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c?rev=46507&r1=46506&r2=46507&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] Sun Mar 28 00:58:09 2010
@@ -145,7 +145,6 @@
             /* WTF? Internal error! */
             DPRINT1("Could not lock the saved DC (%p) for dc %p!\n",
                     hdcSave, pdc->BaseObject.hHmgr);
-            DC_UnlockDc(pdc);
             return;// FALSE;
         }
 




More information about the Ros-diffs mailing list