From 736c7b01119af739da3a94ca8c4977341bf72fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Sat, 3 Apr 2010 16:32:30 +0000 Subject: [PATCH] [WIN32K] Unlock/lock surface when locking DC svn path=/branches/reactos-yarotows/; revision=46697 --- subsystems/win32/win32k/include/dc.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/subsystems/win32/win32k/include/dc.h b/subsystems/win32/win32k/include/dc.h index a662300c931..a209ff28adb 100644 --- a/subsystems/win32/win32k/include/dc.h +++ b/subsystems/win32/win32k/include/dc.h @@ -169,15 +169,19 @@ DC_LockDc(HDC hdc) { PDC pdc; pdc = GDIOBJ_LockObj(hdc, GDILoObjType_LO_DC_TYPE); - + /* Direct DC's need PDEV locking */ if(pdc && pdc->dctype == DCTYPE_DIRECT) { /* Acquire shared PDEV lock */ EngAcquireSemaphoreShared(pdc->ppdev->hsemDevLock); - - /* Get the current surface */ - pdc->dclevel.pSurface = pdc->ppdev->pSurface; + + /* Update Surface if needed */ + if(pdc->dclevel.pSurface != pdc->ppdev->pSurface) + { + if(pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface); + pdc->dclevel.pSurface = PDEVOBJ_pSurface(pdc->ppdev); + } } return pdc; }