Commit 698fddf9 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Properly clean up the new metafile data.

parent 42db8e2b
......@@ -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;
}
......
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