Author: tkreuzer
Date: Tue Mar 17 04:06:34 2009
New Revision: 40069
URL:
http://svn.reactos.org/svn/reactos?rev=40069&view=rev
Log:
- Inline GDIOBJ_UnlockObjByPtr, ASSERT that we don't unlock an already unlocked
object, return how many locks are left.
- Don't access the objects cExclsiveLock field after unlocking it, instead use new
return value of GDIOBJ_UnlockObjByPtr
Modified:
trunk/reactos/subsystems/win32/win32k/eng/driverobj.c
trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/driverobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/driverobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/driverobj.c [iso-8859-1] Tue Mar 17 04:06:34
2009
@@ -128,6 +128,7 @@
IN HDRVOBJ hdo)
{
PEDRIVEROBJ pedo;
+ ULONG cLocks;
/* First lock to get a pointer to the object */
pedo = DRIVEROBJ_LockObject(hdo);
@@ -138,10 +139,10 @@
}
/* Unlock object */
- DRIVEROBJ_UnlockObject(pedo);
+ cLocks = DRIVEROBJ_UnlockObject(pedo);
/* Check if we still hold a lock */
- if (pedo->baseobj.cExclusiveLock < 1)
+ if (cLocks < 1)
{
/* Object wasn't locked before, fail. */
return FALSE;
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Tue Mar 17
04:06:34 2009
@@ -61,7 +61,6 @@
BOOL INTERNAL_CALL GDIOBJ_SetOwnership(HGDIOBJ ObjectHandle, PEPROCESS Owner);
BOOL INTERNAL_CALL GDIOBJ_CopyOwnership(HGDIOBJ CopyFrom, HGDIOBJ CopyTo);
BOOL INTERNAL_CALL GDIOBJ_ConvertToStockObj(HGDIOBJ *hObj);
-VOID INTERNAL_CALL GDIOBJ_UnlockObjByPtr(POBJ Object);
VOID INTERNAL_CALL GDIOBJ_ShareUnlockObjByPtr(POBJ Object);
BOOL INTERNAL_CALL GDIOBJ_ValidateHandle(HGDIOBJ hObj, ULONG ObjectType);
POBJ INTERNAL_CALL GDIOBJ_AllocObj(UCHAR ObjectType);
@@ -84,4 +83,20 @@
BOOL FASTCALL IsObjectDead(HGDIOBJ);
BOOL FASTCALL IntGdiSetDCOwnerEx( HDC, DWORD, BOOL);
+/*!
+ * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked.
+ * You should unlock the object
+ * as soon as you don't need to have access to it's data.
+
+ * \param Object Object pointer (as returned by GDIOBJ_LockObj).
+ */
+ULONG
+FORCEINLINE
+GDIOBJ_UnlockObjByPtr(POBJ Object)
+{
+ INT cLocks = InterlockedDecrement((PLONG)&Object->cExclusiveLock);
+ ASSERT(cLocks >= 0);
+ return cLocks;
+}
+
#endif
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Tue Mar 17
04:06:34 2009
@@ -1014,21 +1014,6 @@
}
-/*!
- * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked. You
should unlock the object
- * as soon as you don't need to have access to it's data.
-
- * \param Object Object pointer (as returned by GDIOBJ_LockObj).
- */
-VOID INTERNAL_CALL
-GDIOBJ_UnlockObjByPtr(POBJ Object)
-{
- if (InterlockedDecrement((PLONG)&Object->cExclusiveLock) < 0)
- {
- DPRINT1("Trying to unlock non-existant object\n");
- }
-}
-
VOID INTERNAL_CALL
GDIOBJ_ShareUnlockObjByPtr(POBJ Object)
{