Author: spouliot
Date: 2007-02-26 08:41:22 -0500 (Mon, 26 Feb 2007)
New Revision: 73423

Modified:
   trunk/libgdiplus/src/ChangeLog
   trunk/libgdiplus/src/region.c
Log:
region.c: Change GdipGetRegionHRgn to return a pointer to a *clone* of the 
region as this better match MS implementation (multiple calls return different 
HRGN). It also means that each of them must be freed individually (or this will 
leak memory).

Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog      2007-02-26 13:00:50 UTC (rev 73422)
+++ trunk/libgdiplus/src/ChangeLog      2007-02-26 13:41:22 UTC (rev 73423)
@@ -1,3 +1,10 @@
+2007-02-26  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * region.c: Change GdipGetRegionHRgn to return a pointer to a *clone*
+       of the region as this better match MS implementation (multiple calls
+       return different HRGN). It also means that each of them must be freed
+       individually (or this will leak memory).
+
 2007-02-22  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * image.c: Fix DrawImage* functions when using indexed bitmaps.

Modified: trunk/libgdiplus/src/region.c
===================================================================
--- trunk/libgdiplus/src/region.c       2007-02-26 13:00:50 UTC (rev 73422)
+++ trunk/libgdiplus/src/region.c       2007-02-26 13:41:22 UTC (rev 73423)
@@ -1759,11 +1759,14 @@
                return InvalidParameter;
 
        /* infinite region returns NULL */
-       if (gdip_is_InfiniteRegion (region))
+       if (gdip_is_InfiniteRegion (region)) {
                *hRgn = NULL;
-       else
-               *hRgn = region;
-       return Ok;
+               return Ok;
+       }
+
+       /* calling GdipGetRegionHRgn multiple times returns a different HRNG 
value
+          (i.e. each to be freed separately) */
+       return GdipCloneRegion (region, (GpRegion**)hRgn);
 }
 
 // coverity[+alloc : arg-*1]

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to