Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2016-09-18 16:32:17 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2016-09-18 16:32:38 +0300
commitcf4b8abf52937aa2b10f69e435ba4cb53796dd9b (patch)
tree1392394f537008682499d0673244d258e37652d1 /main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking
parentd35e78412f136e3a3c981dd66f47768193c55aa2 (diff)
[Ide] Ensure graphics contexts are disposed.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/PlaceholderWindow.cs36
1 files changed, 23 insertions, 13 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/PlaceholderWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/PlaceholderWindow.cs
index faf3966c12..935fa341a9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/PlaceholderWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/PlaceholderWindow.cs
@@ -64,6 +64,15 @@ namespace MonoDevelop.Components.Docking
redgc.RgbFgColor = frame.Style.Background (StateType.Selected);
}
+ protected override void OnDestroyed ()
+ {
+ if (redgc != null) {
+ redgc.Dispose ();
+ redgc = null;
+ }
+ base.OnDestroyed ();
+ }
+
protected override void OnRealized ()
{
base.OnRealized ();
@@ -76,19 +85,20 @@ namespace MonoDevelop.Components.Docking
black = new Gdk.Color (0, 0, 0);
black.Pixel = 1;
white = new Gdk.Color (255, 255, 255);
- white.Pixel = 0;
-
- Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1);
- Gdk.GC gc = new Gdk.GC (pm);
- gc.Background = white;
- gc.Foreground = white;
- pm.DrawRectangle (gc, true, 0, 0, width, height);
-
- gc.Foreground = black;
- pm.DrawRectangle (gc, false, 0, 0, width - 1, height - 1);
- pm.DrawRectangle (gc, false, 1, 1, width - 3, height - 3);
-
- this.ShapeCombineMask (pm, 0, 0);
+ white.Pixel = 0;
+
+ using (Gdk.Pixmap pm = new Pixmap (this.GdkWindow, width, height, 1)) {
+ using (Gdk.GC gc = new Gdk.GC (pm)) {
+ gc.Background = white;
+ gc.Foreground = white;
+ pm.DrawRectangle (gc, true, 0, 0, width, height);
+
+ gc.Foreground = black;
+ pm.DrawRectangle (gc, false, 0, 0, width - 1, height - 1);
+ pm.DrawRectangle (gc, false, 1, 1, width - 3, height - 3);
+ }
+ this.ShapeCombineMask (pm, 0, 0);
+ }
}
protected override void OnSizeAllocated (Rectangle allocation)