diff --git a/dlls/gdi32/mfdrv/graphics.c b/dlls/gdi32/mfdrv/graphics.c index c0c922c7943..316ee7852ce 100644 --- a/dlls/gdi32/mfdrv/graphics.c +++ b/dlls/gdi32/mfdrv/graphics.c @@ -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; } diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 98d9e155c97..00cb8d49d9c 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -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 */ diff --git a/dlls/gdi32/mfdrv/objects.c b/dlls/gdi32/mfdrv/objects.c index 4dc809a430e..a43598bef5b 100644 --- a/dlls/gdi32/mfdrv/objects.c +++ b/dlls/gdi32/mfdrv/objects.c @@ -58,6 +58,23 @@ UINT MFDRV_AddHandle( PHYSDEV dev, HGDIOBJ obj ) 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 */