Author: fireball
Date: Fri May 22 21:19:27 2009
New Revision: 41043
URL:
http://svn.reactos.org/svn/reactos?rev=41043&view=rev
Log:
- Make ObReferenceObjectEx return the new ref count instead of old ref count.
- Fix same bug ObDereferenceObjectEx.
- Fix a typo in ObDereferenceObjectEx which resulted in ObpDeferObjectDeletion not being
called when needed. Fixes missing object deletions in ObDereferenceObjectEx-using code
(e.g. executive timers in reactos kernel).
- Original problem found by
http://www.reactos.org/forum/viewtopic.php?f=14&t=6969&p=59669;p=59669, fixes inspired by
the discussion too.
Modified:
trunk/reactos/ntoskrnl/ob/obref.c
Modified: trunk/reactos/ntoskrnl/ob/obref.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obref.c?rev=41…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obref.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ob/obref.c [iso-8859-1] Fri May 22 21:19:27 2009
@@ -80,7 +80,7 @@
/* Increment the reference count and return the count now */
return InterlockedExchangeAdd(&OBJECT_TO_OBJECT_HEADER(Object)->
PointerCount,
- Count);
+ Count) + Count;
}
LONG
@@ -95,8 +95,8 @@
Header = OBJECT_TO_OBJECT_HEADER(Object);
/* Check whether the object can now be deleted. */
- NewCount = InterlockedExchangeAdd(&Header->PointerCount, -Count);
- if (!Count) ObpDeferObjectDeletion(Header);
+ NewCount = InterlockedExchangeAdd(&Header->PointerCount, -Count) - Count;
+ if (!NewCount) ObpDeferObjectDeletion(Header);
/* Return the current count */
return NewCount;