[hyena] Properly dispose FontDescriptions



commit 13df556b0c766c3753df1f7a9c58be00d2073119
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Mon Mar 15 09:09:58 2010 +1100

    Properly dispose FontDescriptions
    
    Pango.Layout.FontDescription setter and Gtk.Widget.ModifyFont()
    internally create copies of FDs and auto-dispose them. No need
    to create copies ourselves, they wouldn't be disposed.

 src/Hyena.Gui/Hyena.Gui/CairoExtensions.cs |    2 +-
 src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Gui/CairoExtensions.cs b/src/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
index 80c1b67..80cc29d 100644
--- a/src/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
+++ b/src/Hyena.Gui/Hyena.Gui/CairoExtensions.cs
@@ -51,7 +51,7 @@ namespace Hyena.Gui
         public static Pango.Layout CreateLayout (Gtk.Widget widget, Cairo.Context cairo_context)
         {
             Pango.Layout layout = PangoCairoHelper.CreateLayout (cairo_context);
-            layout.FontDescription = widget.PangoContext.FontDescription.Copy ();
+            layout.FontDescription = widget.PangoContext.FontDescription;
 
             double resolution = widget.Screen.Resolution;
             if (resolution != -1) {
diff --git a/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs b/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
index 7356605..f6678a8 100644
--- a/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
+++ b/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
@@ -496,6 +496,7 @@ namespace Hyena.Widgets
             Pango.FontDescription fd = entry3.PangoContext.FontDescription.Copy ();
             fd.Size = (int)(fd.Size * Pango.Scale.XXLarge);
             entry3.ModifyFont (fd);
+            fd.Dispose ();
             box.PackStart (entry3, true, true, 0);
 
             pbox.ShowAll ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]