[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Fri, 26 Mar 2010 16:17:12 +0000 (16:17 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Fri, 26 Mar 2010 16:17:12 +0000 (16:17 +0000)
Lock PDC with pDevObj semaphore too.

svn path=/branches/reactos-yarotows/; revision=46470

subsystems/win32/win32k/include/dc.h
subsystems/win32/win32k/objects/dclife.c

index ebce872..030f2db 100644 (file)
@@ -167,8 +167,8 @@ FORCEINLINE
 DC_LockDc(HDC hdc)
 {
     PDC pdc;
-    pdc = GDIOBJ_LockObj(hdc, GDI_OBJECT_TYPE_DC);
-//    EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
+    pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE);
+    if(pdc) EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock);
     return pdc;
 }
 
@@ -176,7 +176,7 @@ void
 FORCEINLINE
 DC_UnlockDc(PDC pdc)
 {
-//    EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
+    EngReleaseSemaphore(pdc->ppdev->hsemDevLock);
     GDIOBJ_UnlockObjByPtr(&pdc->BaseObject);
 }
 
index 636d20d..bf40082 100644 (file)
@@ -117,6 +117,8 @@ DC_vInitDc(
     DCTYPE dctype,
     PPDEVOBJ ppdev)
 {
+    /* Lock ppdev */
+    EngAcquireSemaphoreShared(ppdev->hsemDevLock);
 
     /* Setup some basic fields */
     pdc->dctype = dctype;
@@ -477,6 +479,7 @@ GreOpenDCW(
     }
     hdc = pdc->BaseObject.hHmgr;
 
+    /* Lock ppdev and initialize the new DC */
     DC_vInitDc(pdc, iType, ppdev);
     /* FIXME: HACK! */
     DC_InitHack(pdc);
@@ -638,7 +641,7 @@ NtGdiCreateCompatibleDC(HDC hdc)
     }
     hdcNew = pdcNew->BaseObject.hHmgr;
 
-    /* Initialize the new DC */
+    /* Lock ppdev and initialize the new DC */
     DC_vInitDc(pdcNew, DCTYPE_MEMORY, ppdev);
     /* FIXME: HACK! */
     DC_InitHack(pdcNew);