mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[WIN32K] Add some validity checks in PDEVOBJ_vReference() and use it instead of explicitly manipulating ppdev->cPdevRefs.
This commit is contained in:
parent
acf689a973
commit
148e137b42
4 changed files with 21 additions and 10 deletions
|
@ -630,7 +630,7 @@ EngpGetPDEV(
|
|||
if (ppdev)
|
||||
{
|
||||
/* Yes, reference the PDEV */
|
||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||
PDEVOBJ_vReference(ppdev);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -162,6 +162,24 @@ NTAPI
|
|||
EngpGetPDEV(
|
||||
_In_opt_ PUNICODE_STRING pustrDevice);
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
PDEVOBJ_vReference(
|
||||
_In_ PPDEVOBJ ppdev)
|
||||
{
|
||||
ASSERT(ppdev);
|
||||
|
||||
/* Fail if the PDEV is being destroyed */
|
||||
if (ppdev->cPdevRefs == 0)
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
return;
|
||||
}
|
||||
ASSERT(ppdev->cPdevRefs > 0);
|
||||
|
||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
PDEVOBJ_vRelease(
|
||||
|
@ -201,11 +219,4 @@ PDEVOBJ_pdmMatchDevMode(
|
|||
PPDEVOBJ ppdev,
|
||||
PDEVMODEW pdm);
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
PDEVOBJ_vReference(PPDEVOBJ ppdev)
|
||||
{
|
||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||
}
|
||||
|
||||
#endif /* !__WIN32K_PDEVOBJ_H */
|
||||
|
|
|
@ -836,7 +836,7 @@ GreCreateCompatibleDC(HDC hdc, BOOL bAltDc)
|
|||
|
||||
/* Get the pdev from the DC */
|
||||
ppdev = pdc->ppdev;
|
||||
InterlockedIncrement(&ppdev->cPdevRefs);
|
||||
PDEVOBJ_vReference(ppdev);
|
||||
|
||||
/* Unlock the source DC */
|
||||
DC_UnlockDc(pdc);
|
||||
|
|
|
@ -282,7 +282,7 @@ NtGdiSaveDC(
|
|||
}
|
||||
hdcSave = pdcSave->BaseObject.hHmgr;
|
||||
|
||||
InterlockedIncrement(&pdc->ppdev->cPdevRefs);
|
||||
PDEVOBJ_vReference(pdc->ppdev);
|
||||
DC_vInitDc(pdcSave, DCTYPE_MEMORY, pdc->ppdev);
|
||||
|
||||
/* Handle references here correctly */
|
||||
|
|
Loading…
Reference in a new issue