[hyena] Hyena.Gui: fix memory leak in RoundedFrame



commit 9656163b8e73a82298153cfde6d05839e0763d49
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Sat Jan 25 17:06:08 2014 +0100

    Hyena.Gui: fix memory leak in RoundedFrame
    
    I stumbled upon this memory leak when using the Dap.MassStorage
    extension in Banshee: Mono.Cairo finalizer traces informed me
    about DapInfoBar.SetBackground() being the creator of a
    LinearGradient class (derived from RoundedFrame) which was
    not being disposed by the programmer, but by the GC.

 Hyena.Gui/Hyena.Widgets/RoundedFrame.cs |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs b/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
index 5cf21e9..b393426 100644
--- a/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
+++ b/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
@@ -86,6 +86,12 @@ namespace Hyena.Widgets
         public Pattern FillPattern {
             get { return fill_pattern; }
             set {
+                if (fill_pattern == value) {
+                    return;
+                }
+                if (fill_pattern != null) {
+                    fill_pattern.Dispose ();
+                }
                 fill_pattern = value;
                 QueueDraw ();
             }


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