mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 17:03:40 +00:00
[WIN32K]
Restore saved DCs, when changing the DC owner. Otherwise there could be saved DCs with references to process owned resources, causing GDI object leaks. Fixes assertion when closing iWisoft Video Converter Also don't copy lSaveDepth and hdcSafe in DC_vCopyState, those must be handled manually. CORE-10435 #resolve svn path=/trunk/; revision=69759
This commit is contained in:
parent
d463d96d4b
commit
36d8294a79
2 changed files with 8 additions and 4 deletions
|
@ -392,13 +392,16 @@ DC_vCleanup(PVOID ObjectBody)
|
||||||
if(pdc->dclevel.pSurface)
|
if(pdc->dclevel.pSurface)
|
||||||
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
|
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
|
||||||
|
|
||||||
PDEVOBJ_vRelease(pdc->ppdev) ;
|
PDEVOBJ_vRelease(pdc->ppdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
DC_vSetOwner(PDC pdc, ULONG ulOwner)
|
DC_vSetOwner(PDC pdc, ULONG ulOwner)
|
||||||
{
|
{
|
||||||
|
/* Delete saved DCs */
|
||||||
|
DC_vRestoreDC(pdc, 1);
|
||||||
|
|
||||||
if (pdc->dclevel.hPath)
|
if (pdc->dclevel.hPath)
|
||||||
{
|
{
|
||||||
GreSetObjectOwner(pdc->dclevel.hPath, ulOwner);
|
GreSetObjectOwner(pdc->dclevel.hPath, ulOwner);
|
||||||
|
|
|
@ -28,8 +28,6 @@ DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To)
|
||||||
|
|
||||||
/* Copy DC level */
|
/* Copy DC level */
|
||||||
pdcDst->dclevel.pColorSpace = pdcSrc->dclevel.pColorSpace;
|
pdcDst->dclevel.pColorSpace = pdcSrc->dclevel.pColorSpace;
|
||||||
pdcDst->dclevel.lSaveDepth = pdcSrc->dclevel.lSaveDepth;
|
|
||||||
pdcDst->dclevel.hdcSave = pdcSrc->dclevel.hdcSave;
|
|
||||||
pdcDst->dclevel.laPath = pdcSrc->dclevel.laPath;
|
pdcDst->dclevel.laPath = pdcSrc->dclevel.laPath;
|
||||||
pdcDst->dclevel.ca = pdcSrc->dclevel.ca;
|
pdcDst->dclevel.ca = pdcSrc->dclevel.ca;
|
||||||
pdcDst->dclevel.mxWorldToDevice = pdcSrc->dclevel.mxWorldToDevice;
|
pdcDst->dclevel.mxWorldToDevice = pdcSrc->dclevel.mxWorldToDevice;
|
||||||
|
@ -131,7 +129,7 @@ DC_vRestoreDC(
|
||||||
HDC hdcSave;
|
HDC hdcSave;
|
||||||
PDC pdcSave;
|
PDC pdcSave;
|
||||||
|
|
||||||
ASSERT(iSaveLevel > 0);
|
NT_ASSERT(iSaveLevel > 0);
|
||||||
DPRINT("DC_vRestoreDC(%p, %ld)\n", pdc->BaseObject.hHmgr, iSaveLevel);
|
DPRINT("DC_vRestoreDC(%p, %ld)\n", pdc->BaseObject.hHmgr, iSaveLevel);
|
||||||
|
|
||||||
/* Loop the save levels */
|
/* Loop the save levels */
|
||||||
|
@ -146,6 +144,7 @@ DC_vRestoreDC(
|
||||||
/* Could not get ownership. That's bad! */
|
/* Could not get ownership. That's bad! */
|
||||||
DPRINT1("Could not get ownership of saved DC (%p) for hdc %p!\n",
|
DPRINT1("Could not get ownership of saved DC (%p) for hdc %p!\n",
|
||||||
hdcSave, pdc->BaseObject.hHmgr);
|
hdcSave, pdc->BaseObject.hHmgr);
|
||||||
|
NT_ASSERT(FALSE);
|
||||||
return;// FALSE;
|
return;// FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +155,7 @@ DC_vRestoreDC(
|
||||||
/* WTF? Internal error! */
|
/* WTF? Internal error! */
|
||||||
DPRINT1("Could not lock the saved DC (%p) for dc %p!\n",
|
DPRINT1("Could not lock the saved DC (%p) for dc %p!\n",
|
||||||
hdcSave, pdc->BaseObject.hHmgr);
|
hdcSave, pdc->BaseObject.hHmgr);
|
||||||
|
NT_ASSERT(FALSE);
|
||||||
return;// FALSE;
|
return;// FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,6 +300,7 @@ NtGdiSaveDC(
|
||||||
if (pdcSave->dclevel.hPath) pdcSave->dclevel.flPath |= DCPATH_SAVE;
|
if (pdcSave->dclevel.hPath) pdcSave->dclevel.flPath |= DCPATH_SAVE;
|
||||||
|
|
||||||
/* Set new dc as save dc */
|
/* Set new dc as save dc */
|
||||||
|
pdcSave->dclevel.hdcSave = pdc->dclevel.hdcSave;
|
||||||
pdc->dclevel.hdcSave = hdcSave;
|
pdc->dclevel.hdcSave = hdcSave;
|
||||||
|
|
||||||
/* Increase save depth, return old value */
|
/* Increase save depth, return old value */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue