gdi32: Avoid leaking a handle in MFDRV_ExtSelectClipRgn.

This commit is contained in:
Alexandre Julliard 2007-01-02 17:09:10 +01:00
parent 2159f2bce8
commit 0bd3d8e68e
3 changed files with 19 additions and 0 deletions

View File

@ -420,6 +420,7 @@ INT MFDRV_ExtSelectClipRgn( PHYSDEV dev, HRGN hrgn, INT mode )
if(iRgn == -1) return ERROR; if(iRgn == -1) return ERROR;
ret = MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? NULLREGION : ERROR; ret = MFDRV_MetaParam1( dev, META_SELECTCLIPREGION, iRgn ) ? NULLREGION : ERROR;
MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn ); MFDRV_MetaParam1( dev, META_DELETEOBJECT, iRgn );
MFDRV_RemoveHandle( dev, iRgn );
return ret; return ret;
} }

View File

@ -56,6 +56,7 @@ extern BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2
short param6, short param7, short param8); short param6, short param7, short param8);
extern BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen); extern BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen);
extern UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj ); extern UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj );
extern BOOL MFDRV_RemoveHandle( PHYSDEV dev, UINT index );
extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ); extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush );
/* Metafile driver functions */ /* Metafile driver functions */

View File

@ -58,6 +58,23 @@ UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj )
return index ; /* index 0 is not reserved for metafiles */ return index ; /* index 0 is not reserved for metafiles */
} }
/******************************************************************
* 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 * MFDRV_FindObject
*/ */