[banshee] TrackEditor: dispose local variable in a finally block



commit d3c75c0cd4300f9ffaf6c81369898819fcea113b
Author: Mirco Bauer <meebey meebey net>
Date:   Sun Dec 1 16:58:54 2013 +0100

    TrackEditor: dispose local variable in a finally block
    
    All Dispose() calls should happen in finally blocks to avoid leaks
    when exceptions happen, so we apply a using{} block here.
    
    Signed-off-by: Andrés G. Aragoneses <knocte gmail com>

 .../Banshee.Gui.TrackEditor/TextViewEntry.cs       |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TextViewEntry.cs 
b/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TextViewEntry.cs
index d2f2935..0fcbc2d 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TextViewEntry.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TextViewEntry.cs
@@ -64,10 +64,11 @@ namespace Banshee.Gui.TrackEditor
 
         protected override void OnGetPreferredHeight (out int minimum_height, out int natural_height)
         {
-            Pango.FontMetrics metrics = PangoContext.GetMetrics (
-                entry.StyleContext.GetFont (StateFlags.Normal), PangoContext.Language);
-            int line_height = ((int)(metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS(d)
-            metrics.Dispose ();
+            int line_height;
+            using (Pango.FontMetrics metrics = PangoContext.GetMetrics (
+                entry.StyleContext.GetFont (StateFlags.Normal), PangoContext.Language)) {
+                line_height = ((metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS(d)
+            }
             minimum_height = natural_height = (line_height + 2) * 2;
         }
 


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