gdiplus: Properly clean up the new metafile data.
This commit is contained in:
parent
42db8e2bfa
commit
698fddf99b
|
@ -2027,7 +2027,21 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
|
|||
DeleteDC(((GpBitmap*)image)->hdc);
|
||||
DeleteObject(((GpBitmap*)image)->hbitmap);
|
||||
}
|
||||
else if (image->type != ImageTypeMetafile)
|
||||
else if (image->type == ImageTypeMetafile)
|
||||
{
|
||||
GpMetafile *metafile = (GpMetafile*)image;
|
||||
GdipFree(metafile->comment_data);
|
||||
DeleteEnhMetaFile(CloseEnhMetaFile(metafile->record_dc));
|
||||
DeleteEnhMetaFile(metafile->hemf);
|
||||
if (metafile->record_graphics)
|
||||
{
|
||||
WARN("metafile closed while recording\n");
|
||||
/* not sure what to do here; for now just prevent the graphics from functioning or using this object */
|
||||
metafile->record_graphics->image = NULL;
|
||||
metafile->record_graphics->busy = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN("invalid image: %p\n", image);
|
||||
return ObjectBusy;
|
||||
|
|
|
@ -307,6 +307,10 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
|
|||
metafile->hemf = CloseEnhMetaFile(metafile->record_dc);
|
||||
metafile->record_dc = NULL;
|
||||
|
||||
GdipFree(metafile->comment_data);
|
||||
metafile->comment_data = NULL;
|
||||
metafile->comment_data_size = 0;
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue