[WIN32K] ASSERT that all callout references have been cleaned up on thread exit

This commit is contained in:
Timo Kreuzer 2023-09-25 20:12:51 +03:00
parent 690783179e
commit 9eca7c52f6
3 changed files with 12 additions and 0 deletions

View file

@ -813,6 +813,9 @@ ExitThreadCallback(PETHREAD Thread)
UserDereferenceObject(ref->obj);
psle = PopEntryList(&ptiCurrent->ReferencesList);
#if DBG
ptiCurrent->cRefObjectCo--;
#endif
}
}
@ -872,6 +875,8 @@ ExitThreadCallback(PETHREAD Thread)
}
ptiCurrent->hEventQueueClient = NULL;
ASSERT(ptiCurrent->cRefObjectCo == 0);
/* The thread is dying */
PsSetThreadWin32Thread(Thread /*ptiCurrent->pEThread*/, NULL, ptiCurrent);

View file

@ -34,6 +34,9 @@ UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
UserReferenceEntry->obj = obj;
UserReferenceObject(obj);
PushEntryList(&W32Thread->ReferencesList, &UserReferenceEntry->Entry);
#if DBG
W32Thread->cRefObjectCo++;
#endif
}
static __inline VOID
@ -53,6 +56,9 @@ UserDerefObjectCo(PVOID obj)
ASSERT(obj == UserReferenceEntry->obj);
UserDereferenceObject(obj);
#if DBG
W32Thread->cRefObjectCo--;
#endif
}
void FreeProcMarkObject(_In_ PVOID Object);

View file

@ -158,6 +158,7 @@ typedef struct _THREADINFO
ULONG cExclusiveLocks;
#if DBG
USHORT acExclusiveLockCount[GDIObjTypeTotal + 1];
UINT cRefObjectCo;
#endif
#endif // __cplusplus
} THREADINFO;