[1/2] gdiplus: Don't keep a reference to HDC in the GpBitmap object.

Vincent Povirk madewokherd at gmail.com
Fri Jul 27 08:49:59 CDT 2012

> an image passed to GdipGetImageGraphicsContext() is destroyed right after
> the graphics object was created, then later on all calls using that HDC fail
> and silently lead to using invalid or not initilazed values.

You have to keep the image alive as long as you're using the Graphics
object. If you're not doing that, then you have a use-after-free and I
don't trust the results of your test.

We shouldn't need to have any HDC for much longer in this case anyway.
Once we have a software implementation of line-drawing (which should
just be a matter of filling a path from GdipWidenPath), we can get rid
of the HBITMAP and HDC on Bitmap objects.

More information about the wine-devel mailing list