Author: spouliot
Date: 2007-02-26 08:42:51 -0500 (Mon, 26 Feb 2007)
New Revision: 73424

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing/Region.cs
   trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
Log:
2007-02-26  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * gdipFunctions.cs: Add p/invoke signature for GDI DeleteObject.
        * Region.cs: Under Windows use DeleteObject when calling ReleaseHrgn.
        Fix bug #80956.



Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2007-02-26 
13:41:22 UTC (rev 73423)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2007-02-26 
13:42:51 UTC (rev 73424)
@@ -1,3 +1,9 @@
+2007-02-26  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * gdipFunctions.cs: Add p/invoke signature for GDI DeleteObject.
+       * Region.cs: Under Windows use DeleteObject when calling ReleaseHrgn.
+       Fix bug #80956.
+
 2007-02-21  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * Image.cs: Fix Metefile.ctor usage (to avoid creating, and leaking,

Modified: trunk/mcs/class/System.Drawing/System.Drawing/Region.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Region.cs     2007-02-26 
13:41:22 UTC (rev 73423)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Region.cs     2007-02-26 
13:42:51 UTC (rev 73424)
@@ -642,13 +642,22 @@
                        }
                }
 #if NET_2_0
+               // why is this a instance method ? and not static ?
                [SecurityPermission (SecurityAction.Demand, UnmanagedCode = 
true)]
                public void ReleaseHrgn (IntPtr regionHandle)           
                {
                        if (regionHandle == IntPtr.Zero) 
                                throw new ArgumentNullException 
("regionHandle");
 
-                       Status status = GDIPlus.GdipDeleteRegion (regionHandle);
+                       Status status = Status.Ok;
+                       if (GDIPlus.RunningOnUnix ()) {
+                               // for libgdiplus HRGN == GpRegion* 
+                               status = GDIPlus.GdipDeleteRegion 
(regionHandle);
+                       } else {
+                               // ... but on Windows HRGN are (old) GDI objects
+                               if (!GDIPlus.DeleteObject (regionHandle))
+                                       status = Status.InvalidParameter;
+                       }
                        GDIPlus.CheckStatus (status);
                }
 #endif

Modified: trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs      
2007-02-26 13:41:22 UTC (rev 73423)
+++ trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs      
2007-02-26 13:42:51 UTC (rev 73424)
@@ -1451,7 +1451,8 @@
                internal static extern IntPtr CreateIconIndirect ([In] ref 
IconInfo piconinfo);
                [DllImport("user32.dll", CallingConvention = 
CallingConvention.StdCall, SetLastError=true)]
                internal static extern bool DestroyIcon (IntPtr hIcon);
- 
+               [DllImport("gdi32.dll")]
+               internal static extern bool DeleteObject (IntPtr hObject);
                [DllImport("user32.dll")]
                internal static extern IntPtr GetDesktopWindow ();
 

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

Reply via email to