Author: tkreuzer
Date: Sat Oct 31 19:37:36 2015
New Revision: 69759
URL:
http://svn.reactos.org/svn/reactos?rev=69759&view=rev
Log:
[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
Modified:
trunk/reactos/win32ss/gdi/ntgdi/dclife.c
trunk/reactos/win32ss/gdi/ntgdi/dcstate.c
Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Sat Oct 31 19:37:36 2015
@@ -392,13 +392,16 @@
if(pdc->dclevel.pSurface)
SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface);
- PDEVOBJ_vRelease(pdc->ppdev) ;
+ PDEVOBJ_vRelease(pdc->ppdev);
}
VOID
NTAPI
DC_vSetOwner(PDC pdc, ULONG ulOwner)
{
+ /* Delete saved DCs */
+ DC_vRestoreDC(pdc, 1);
+
if (pdc->dclevel.hPath)
{
GreSetObjectOwner(pdc->dclevel.hPath, ulOwner);
Modified: trunk/reactos/win32ss/gdi/ntgdi/dcstate.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dcstate.…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/dcstate.c [iso-8859-1] Sat Oct 31 19:37:36 2015
@@ -28,8 +28,6 @@
/* Copy DC level */
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.ca = pdcSrc->dclevel.ca;
pdcDst->dclevel.mxWorldToDevice = pdcSrc->dclevel.mxWorldToDevice;
@@ -131,7 +129,7 @@
HDC hdcSave;
PDC pdcSave;
- ASSERT(iSaveLevel > 0);
+ NT_ASSERT(iSaveLevel > 0);
DPRINT("DC_vRestoreDC(%p, %ld)\n", pdc->BaseObject.hHmgr, iSaveLevel);
/* Loop the save levels */
@@ -146,6 +144,7 @@
/* Could not get ownership. That's bad! */
DPRINT1("Could not get ownership of saved DC (%p) for hdc %p!\n",
hdcSave, pdc->BaseObject.hHmgr);
+ NT_ASSERT(FALSE);
return;// FALSE;
}
@@ -156,6 +155,7 @@
/* WTF? Internal error! */
DPRINT1("Could not lock the saved DC (%p) for dc %p!\n",
hdcSave, pdc->BaseObject.hHmgr);
+ NT_ASSERT(FALSE);
return;// FALSE;
}
@@ -300,6 +300,7 @@
if (pdcSave->dclevel.hPath) pdcSave->dclevel.flPath |= DCPATH_SAVE;
/* Set new dc as save dc */
+ pdcSave->dclevel.hdcSave = pdc->dclevel.hdcSave;
pdc->dclevel.hdcSave = hdcSave;
/* Increase save depth, return old value */