[hyena] Properly (and consistently) dispose CairoContext



commit a35dd6981b1876e35d5baed6f1ae04f30cfee3bd
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date:   Fri Feb 12 20:27:16 2010 +1100

    Properly (and consistently) dispose CairoContext

 .../Hyena.Data.Gui/ListView/ListView_Rendering.cs  |    3 +--
 src/Hyena.Gui/Hyena.Widgets/MessageBar.cs          |    3 +--
 src/Hyena.Gui/Hyena.Widgets/PulsingButton.cs       |    2 +-
 src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs         |    3 +--
 src/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs        |    3 +--
 src/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs        |    3 +--
 6 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index e529ba7..a8b808a 100644
--- a/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/src/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -138,8 +138,7 @@ namespace Hyena.Data.Gui
 
             PaintDraggingColumn (damage);
 
-            ((IDisposable)cairo_context.Target).Dispose ();
-            ((IDisposable)cairo_context).Dispose ();
+            CairoExtensions.DisposeContext (cairo_context);
 
             return true;
         }
diff --git a/src/Hyena.Gui/Hyena.Widgets/MessageBar.cs b/src/Hyena.Gui/Hyena.Widgets/MessageBar.cs
index 1934697..9582664 100644
--- a/src/Hyena.Gui/Hyena.Widgets/MessageBar.cs
+++ b/src/Hyena.Gui/Hyena.Widgets/MessageBar.cs
@@ -141,8 +141,7 @@ namespace Hyena.Widgets
                 theme.DrawFrame (cr, Allocation, CairoExtensions.GdkColorToCairoColor (color));
                 return base.OnExposeEvent (evnt);
             } finally {
-                ((IDisposable)cr.Target).Dispose ();
-                ((IDisposable)cr).Dispose ();
+                CairoExtensions.DisposeContext (cr);
             }
         }
 
diff --git a/src/Hyena.Gui/Hyena.Widgets/PulsingButton.cs b/src/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
index c7b57eb..4ee6b8b 100644
--- a/src/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
+++ b/src/Hyena.Gui/Hyena.Widgets/PulsingButton.cs
@@ -108,7 +108,7 @@ namespace Hyena.Widgets
             cr.Fill ();
             fill.Destroy ();
 
-            ((IDisposable)cr).Dispose ();
+            CairoExtensions.DisposeContext (cr);
             return base.OnExposeEvent (evnt);
         }
 
diff --git a/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs b/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
index ddaf603..7356605 100644
--- a/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
+++ b/src/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
@@ -268,8 +268,7 @@ namespace Hyena.Widgets
                 State == StateType.Insensitive ? 1 : 0.90,
                 State == StateType.Insensitive ? 1 : 0.55,
                 State == StateType.Insensitive ? 1 : 0.45);
-            ((IDisposable)cr.Target).Dispose ();
-            ((IDisposable)cr).Dispose ();
+            CairoExtensions.DisposeContext (cr);
 
             return true;
         }
diff --git a/src/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs b/src/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
index 0e5d9f6..5c6a125 100644
--- a/src/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
+++ b/src/Hyena.Gui/Hyena.Widgets/RoundedFrame.cs
@@ -156,8 +156,7 @@ namespace Hyena.Widgets
                 }
                 return false;
             } finally {
-                ((IDisposable)cr.Target).Dispose ();
-                ((IDisposable)cr).Dispose ();
+                CairoExtensions.DisposeContext (cr);
             }
         }
 
diff --git a/src/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs b/src/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
index 5f5f0a2..66e8fab 100644
--- a/src/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
+++ b/src/Hyena.Gui/Hyena.Widgets/SegmentedBar.cs
@@ -374,8 +374,7 @@ namespace Hyena.Widgets
             }
 
             bar.Destroy ();
-            ((IDisposable)cr.Target).Dispose ();
-            ((IDisposable)cr).Dispose ();
+            CairoExtensions.DisposeContext (cr);
 
             return true;
         }



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