2006-01-26 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Thu, 26 Jan 2006 18:59:07 +0000 (18:59 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Thu, 26 Jan 2006 18:59:07 +0000 (18:59 -0000)
* FontFamily.cs: Free the memory allocated with Marshal.AllocHGlobal.
* Region.cs: Updated TODO to reflect current status.

svn path=/trunk/mcs/; revision=56117

mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/FontFamily.cs
mcs/class/System.Drawing/System.Drawing/Region.cs

index af648fcc4b108610e35d255e54ae045fb482e720..f954f92a176aca9dd1e863b52554a771e090768c 100644 (file)
@@ -1,3 +1,8 @@
+2006-01-26  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * FontFamily.cs: Free the memory allocated with Marshal.AllocHGlobal.
+       * Region.cs: Updated TODO to reflect current status.
+
 2006-01-24  Konstantin Triger <kostat@mainsoft.com>
 
         * Font.jvm.cs, FontFamily.jvm.cs: use static container.
index 353e5d67ae5d3c2ea3dc899e160654a50fd3bb8b..7c129e002998a17e56702fa4668350b52c37ddd9 100644 (file)
@@ -6,8 +6,7 @@
 //   Alexandre Pigolkine (pigolkine@gmx.de)
 //
 // Copyright (C) 2002/2004 Ximian, Inc http://www.ximian.com
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -28,7 +27,7 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Drawing.Text;
 using System.Text;
 using System.Runtime.InteropServices;
@@ -52,15 +51,21 @@ namespace System.Drawing {
                
                internal void refreshName()
                {
-                       if (nativeFontFamily != IntPtr.Zero) {
-                               int language = 0;                       
-                               IntPtr buffer;
+                       if (nativeFontFamily == IntPtr.Zero)
+                               return;
 
+                       int language = 0;                       
+                       IntPtr buffer = IntPtr.Zero;
+                       try {
                                buffer = Marshal.AllocHGlobal(GDIPlus.FACESIZE * UnicodeEncoding.CharSize);
                                Status status = GDIPlus.GdipGetFamilyName (nativeFontFamily, buffer, language);
                                GDIPlus.CheckStatus (status);
                                name = Marshal.PtrToStringUni(buffer);
                        }
+                       finally {
+                               if (buffer != IntPtr.Zero)
+                                       Marshal.FreeHGlobal (buffer);
+                       }
                }
                
                //Need to come back here, is Arial the right thing to do
index b53aaa37cf611972ea98bf61411b3a006d80f934..b578541e5e841dc1f06a82828926df75d5ef97c9 100644 (file)
@@ -37,6 +37,7 @@ namespace System.Drawing
 #if !NET_2_0
        [ComVisible (false)]
 #endif
+       [MonoTODO ("Region are limited to rectangles when using libgdiplus")]
        public sealed class Region : MarshalByRefObject, IDisposable
        {
                 private IntPtr nativeRegion = IntPtr.Zero;
@@ -52,7 +53,6 @@ namespace System.Drawing
                         nativeRegion = native; 
                 }
                 
-               [MonoTODO ("GdipCreateRegionPath is not implemented in libgdiplus")]
                public Region (GraphicsPath path)
                {
                        if (path == null)
@@ -73,7 +73,6 @@ namespace System.Drawing
                        GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO ("GdipCreateRegionRgnData is not implemented in libgdiplus")]
                public Region (RegionData rgnData)
                {
                        if (rgnData == null)
@@ -87,6 +86,7 @@ namespace System.Drawing
                // Union
                //
 
+               [MonoTODO ("GdipCombineRegionPath isn't implemented in libgdiplus")]
                public void Union (GraphicsPath path)
                {
                        if (path == null)
@@ -579,7 +579,8 @@ namespace System.Drawing
                        GDIPlus.FromUnManagedMemoryToRectangles (dest, rects);                  
                        return rects;                   
                }               
-               
+
+               [MonoTODO ("GdipTransformRegion isn't implemented in libgdiplus")]              
                public void Transform(Matrix matrix)
                {
                        if (matrix == null)