Commit 0bd3d8e6 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Avoid leaking a handle in MFDRV_ExtSelectClipRgn.

parent 2159f2bc
......@@ -420,6 +420,7 @@ INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
if(iRgn == -1) return ERROR;
ret = MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? NULLREGION : ERROR;
MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn );
MFDRV_RemoveHandle( dev, iRgn );
return ret;
}
......
......@@ -56,6 +56,7 @@ extern BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2
short param6, short param7, short param8);
extern BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen);
extern UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj );
extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index );
extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush );
/* Metafile driver functions */
......
......@@ -59,6 +59,23 @@ UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj )
}
/******************************************************************
* MFDRV_RemoveHandle
*/
BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index )
{
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
BOOL ret = FALSE;
if (index < physDev->handles_size && physDev->handles[index])
{
physDev->handles[index] = 0;
physDev->cur_handles--;
ret = TRUE;
}
return ret;
}
/******************************************************************
* MFDRV_FindObject
*/
static INT16 MFDRV_FindObject( PHYSDEV dev, HGDIOBJ obj )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment