mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:22:57 +00:00
- 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, fixes inspired by the discussion too. svn path=/trunk/; revision=41043
This commit is contained in:
parent
5826eb2c18
commit
e7a4eae2bb
1 changed files with 3 additions and 3 deletions
|
@ -80,7 +80,7 @@ ObReferenceObjectEx(IN PVOID Object,
|
||||||
/* Increment the reference count and return the count now */
|
/* Increment the reference count and return the count now */
|
||||||
return InterlockedExchangeAdd(&OBJECT_TO_OBJECT_HEADER(Object)->
|
return InterlockedExchangeAdd(&OBJECT_TO_OBJECT_HEADER(Object)->
|
||||||
PointerCount,
|
PointerCount,
|
||||||
Count);
|
Count) + Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
LONG
|
LONG
|
||||||
|
@ -95,8 +95,8 @@ ObDereferenceObjectEx(IN PVOID Object,
|
||||||
Header = OBJECT_TO_OBJECT_HEADER(Object);
|
Header = OBJECT_TO_OBJECT_HEADER(Object);
|
||||||
|
|
||||||
/* Check whether the object can now be deleted. */
|
/* Check whether the object can now be deleted. */
|
||||||
NewCount = InterlockedExchangeAdd(&Header->PointerCount, -Count);
|
NewCount = InterlockedExchangeAdd(&Header->PointerCount, -Count) - Count;
|
||||||
if (!Count) ObpDeferObjectDeletion(Header);
|
if (!NewCount) ObpDeferObjectDeletion(Header);
|
||||||
|
|
||||||
/* Return the current count */
|
/* Return the current count */
|
||||||
return NewCount;
|
return NewCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue