Author: pbartok
Date: 2006-03-23 15:11:49 -0500 (Thu, 23 Mar 2006)
New Revision: 58381

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing.Text/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
   trunk/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
Log:
2006-03-23  Peter Dennis Bartok  <[EMAIL PROTECTED]> 

        * FontCollection.cs (Dispose): When on Linux/Unix, call 
          GdipDeletePrivateFontCollection to free up the font collection (even
          though it's not private, we'd be leaking otherwise. Don't try this
          with Microsoft's GDI+ on Win32, though.)



Modified: trunk/mcs/class/System.Drawing/System.Drawing.Text/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Text/ChangeLog        
2006-03-23 20:09:52 UTC (rev 58380)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Text/ChangeLog        
2006-03-23 20:11:49 UTC (rev 58381)
@@ -1,3 +1,10 @@
+2006-03-23  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
+
+       * FontCollection.cs (Dispose): When on Linux/Unix, call 
+         GdipDeletePrivateFontCollection to free up the font collection (even
+         though it's not private, we'd be leaking otherwise. Don't try this
+         with Microsoft's GDI+ on Win32, though.)
+
 2006-03-23  Peter Dennis Bartok  <[EMAIL PROTECTED]>
 
        * FontCollection.cs (get_Families): Now letting the runtime do the

Modified: trunk/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs        
2006-03-23 20:09:52 UTC (rev 58380)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Text/FontCollection.cs        
2006-03-23 20:11:49 UTC (rev 58381)
@@ -56,6 +56,14 @@
 
                protected virtual void Dispose (bool disposing)
                {               
+                       OperatingSystem osInfo = Environment.OSVersion;
+
+                       if (nativeFontCollection != IntPtr.Zero) {
+                               if ((int) osInfo.Platform == 128 || (int) 
osInfo.Platform == 4) {
+                                       GDIPlus.GdipDeletePrivateFontCollection 
(ref nativeFontCollection);
+                                       nativeFontCollection = IntPtr.Zero;
+                               }       
+                       }
                }
 
                // properties

Modified: 
trunk/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs 
2006-03-23 20:09:52 UTC (rev 58380)
+++ trunk/mcs/class/System.Drawing/System.Drawing.Text/PrivateFontCollection.cs 
2006-03-23 20:11:49 UTC (rev 58381)
@@ -74,6 +74,10 @@
                {
                        if (nativeFontCollection!=IntPtr.Zero){
                                GDIPlus.GdipDeletePrivateFontCollection (ref 
nativeFontCollection);                                                     
+
+                               // This must be zeroed out, otherwise our base 
will also call
+                               // the GDI+ delete method on unix platforms. 
We're keeping the
+                               // base.Dispose() call in case other cleanup 
ever gets added there
                                nativeFontCollection = IntPtr.Zero;
                        }
                        

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

Reply via email to