Vincent Povirk : gdiplus: Only release device contexts created internally.

Alexandre Julliard julliard at winehq.org
Mon Apr 27 08:04:05 CDT 2009


Module: wine
Branch: master
Commit: 8a3d9ff773c85a724fab2ede41921b0afacd194f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8a3d9ff773c85a724fab2ede41921b0afacd194f

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Fri Apr 24 13:29:56 2009 -0500

gdiplus: Only release device contexts created internally.

---

 dlls/gdiplus/gdiplus_private.h |    1 +
 dlls/gdiplus/graphics.c        |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index dbeebe3..a8c49d3 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -91,6 +91,7 @@ struct GpPen{
 struct GpGraphics{
     HDC hdc;
     HWND hwnd;
+    BOOL owndc;
     SmoothingMode smoothing;
     CompositingQuality compqual;
     InterpolationMode interpolation;
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 2a98ee5..af3968c 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -924,6 +924,7 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra
 
     (*graphics)->hdc = hdc;
     (*graphics)->hwnd = WindowFromDC(hdc);
+    (*graphics)->owndc = FALSE;
     (*graphics)->smoothing = SmoothingModeDefault;
     (*graphics)->compqual = CompositingQualityDefault;
     (*graphics)->interpolation = InterpolationModeDefault;
@@ -947,6 +948,7 @@ GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics)
         return ret;
 
     (*graphics)->hwnd = hwnd;
+    (*graphics)->owndc = TRUE;
 
     return Ok;
 }
@@ -1081,7 +1083,7 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
     if(!graphics) return InvalidParameter;
     if(graphics->busy) return ObjectBusy;
 
-    if(graphics->hwnd)
+    if(graphics->owndc)
         ReleaseDC(graphics->hwnd, graphics->hdc);
 
     GdipDeleteRegion(graphics->clip);




More information about the wine-cvs mailing list