Author: tkreuzer
Date: Tue May 1 09:29:41 2012
New Revision: 56458
URL:
http://svn.reactos.org/svn/reactos?rev=56458&view=rev
Log:
[WIN32K]
Don't calll GDIOBJ_vDereferenceObject from GDIOBJ_vUnlockObject, instead manually
decrement the reference count. This allows us to ASSERT that the former function is never
called with an exclusive lock held.
Modified:
trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Tue May 1 09:29:41 2012
@@ -476,6 +476,9 @@
{
ULONG cRefs, ulIndex;
+ /* Must not be exclusively locked */
+ ASSERT(pobj->cExclusiveLock == 0);
+
/* Check if the object has a handle */
if (GDI_HANDLE_GET_INDEX(pobj->hHmgr))
{
@@ -647,11 +650,13 @@
NTAPI
GDIOBJ_vUnlockObject(POBJ pobj)
{
+ ULONG cRefs, ulIndex;
ASSERT(pobj->cExclusiveLock > 0);
/* Decrease lock count */
pobj->cExclusiveLock--;
DBG_DECREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), pobj->hHmgr);
+ DBG_LOGEVENT(&pobj->slhLog, EVENT_UNLOCK, 0);
/* Check if this was the last lock */
if (pobj->cExclusiveLock == 0)
@@ -664,9 +669,13 @@
KeLeaveCriticalRegion();
}
- /* Dereference the object */
- DBG_LOGEVENT(&pobj->slhLog, EVENT_UNLOCK, 0);
- GDIOBJ_vDereferenceObject(pobj);
+ /* Calculate the index */
+ ulIndex = GDI_HANDLE_GET_INDEX(pobj->hHmgr);
+
+ /* Decrement reference count */
+ ASSERT((gpaulRefCount[ulIndex] & REF_MASK_COUNT) > 0);
+ cRefs = InterlockedDecrement((LONG*)&gpaulRefCount[ulIndex]);
+ ASSERT(cRefs & REF_MASK_VALID);
}
HGDIOBJ