Commit 7b004c17 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Store the image type on a Graphics object in case the image is freed.

parent edea85de
......@@ -154,6 +154,7 @@ struct GpGraphics{
BOOL owndc;
BOOL alpha_hdc;
GpImage *image;
ImageType image_type;
SmoothingMode smoothing;
CompositingQuality compqual;
InterpolationMode interpolation;
......
......@@ -2195,6 +2195,9 @@ GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics)
(*graphics)->hwnd = NULL;
(*graphics)->owndc = FALSE;
(*graphics)->image = image;
/* We have to store the image type here because the image may be freed
* before GdipDeleteGraphics is called, and metafiles need special treatment. */
(*graphics)->image_type = image->type;
(*graphics)->smoothing = SmoothingModeDefault;
(*graphics)->compqual = CompositingQualityDefault;
(*graphics)->interpolation = InterpolationModeBilinear;
......@@ -2389,7 +2392,7 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
if(!graphics) return InvalidParameter;
if(graphics->busy) return ObjectBusy;
if (graphics->image && graphics->image->type == ImageTypeMetafile)
if (graphics->image && graphics->image_type == ImageTypeMetafile)
{
stat = METAFILE_GraphicsDeleted((GpMetafile*)graphics->image);
if (stat != Ok)
......
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