[ros-diffs] [tkreuzer] 56525: [WIN32K] Do not ASSERT that the object is not exclusively locked in GDIOBJ_vDereferenceObject. The idea behind this was to easily detect cases where someone would accidentally der...

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Sun May 6 11:51:58 UTC 2012


Author: tkreuzer
Date: Sun May  6 11:51:57 2012
New Revision: 56525

URL: http://svn.reactos.org/svn/reactos?rev=56525&view=rev
Log:
[WIN32K]
Do not ASSERT that the object is not exclusively locked in GDIOBJ_vDereferenceObject. The idea behind this was to easily detect cases where someone would accidentally dereference an object, instead of unlocking it. But this function is used from other functions, that can definately deal with exclusively locked objects. Changing this would leat to code duplication / more complex code.
Forgetting to unlock an object will still be detected by the kernel, when returning to user mode, since APC would still be disabled.
Should fix failed assertion when running dx9 setup.

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?rev=56525&r1=56524&r2=56525&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Sun May  6 11:51:57 2012
@@ -476,9 +476,7 @@
 {
     ULONG cRefs, ulIndex;
 
-    /* Must not be exclusively locked */
-    ASSERT(pobj->cExclusiveLock == 0);
-
+    /* Log the event */
     DBG_LOGEVENT(&pobj->slhLog, EVENT_DEREFERENCE, cRefs);
 
     /* Check if the object has a handle */
@@ -489,10 +487,10 @@
 
         /* Decrement reference count */
         ASSERT((gpaulRefCount[ulIndex] & REF_MASK_COUNT) > 0);
-        cRefs = InterlockedDecrement((LONG*)&gpaulRefCount[ulIndex]) & REF_MASK_INUSE;
+        cRefs = InterlockedDecrement((LONG*)&gpaulRefCount[ulIndex]);
 
         /* Check if we reached 0 and handle bit is not set */
-        if (cRefs == 0)
+        if ((cRefs & REF_MASK_INUSE) == 0)
         {
             /* Make sure it's ok to delete the object */
             ASSERT(pobj->BaseFlags & BASEFLAG_READY_TO_DIE);




More information about the Ros-diffs mailing list