[longomatch] Fix more missing calls to Dispose



commit 3acca3244f03120c5d9324bf9b37d55d86c3efb7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Fri Aug 22 22:20:02 2014 +0200

    Fix more missing calls to Dispose

 LongoMatch.Drawing/Canvas.cs                       |   11 ++++++--
 LongoMatch.Drawing/Widgets/Blackboard.cs           |    5 +---
 LongoMatch.Drawing/Widgets/CategoriesLabels.cs     |    2 +-
 LongoMatch.Drawing/Widgets/Dashboard.cs            |    5 +---
 LongoMatch.Drawing/Widgets/PlaysTimeline.cs        |    2 +-
 LongoMatch.Drawing/Widgets/PositionTagger.cs       |    4 +-
 LongoMatch.Drawing/Widgets/TimersTimeline.cs       |    2 +-
 LongoMatch.GUI/Gui/Component/CodingWidget.cs       |    1 +
 LongoMatch.GUI/Gui/Component/Timeline.cs           |    2 +
 .../LongoMatch.Gui.Component.CodingWidget.cs       |   26 ++++++++++----------
 LongoMatch.GUI/gtk-gui/gui.stetic                  |   24 +++++++++---------
 11 files changed, 43 insertions(+), 41 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index 4e277cf..c3e2fe4 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -62,15 +62,20 @@ namespace LongoMatch.Drawing
                protected virtual void Dispose (bool disposing)
                {
                        if (disposing) {
+                               Clear ();
+                               Objects = null;
+                               disposed = true;
+                       }
+               }
+
+               protected void Clear ()
+               {
                                if (Objects != null) {
                                        foreach (CanvasObject co in Objects) {
                                                co.Dispose ();
                                        }
                                }
                                Objects.Clear ();
-                               Objects = null;
-                               disposed = true;
-                       }
                }
 
                public List<ICanvasObject> Objects {
diff --git a/LongoMatch.Drawing/Widgets/Blackboard.cs b/LongoMatch.Drawing/Widgets/Blackboard.cs
index df25509..61ff3ea 100644
--- a/LongoMatch.Drawing/Widgets/Blackboard.cs
+++ b/LongoMatch.Drawing/Widgets/Blackboard.cs
@@ -130,10 +130,7 @@ namespace LongoMatch.Drawing.Widgets
                public void Clear (bool resetDrawing = true)
                {
                        ClearSelection ();
-                       foreach (CanvasObject co in Objects) {
-                               co.Dispose ();
-                       }
-                       Objects.Clear ();
+                       Clear ();
                        if (drawing != null && resetDrawing) {
                                drawing.Drawables.Clear ();
                        }
diff --git a/LongoMatch.Drawing/Widgets/CategoriesLabels.cs b/LongoMatch.Drawing/Widgets/CategoriesLabels.cs
index b31c86e..0c9a03e 100644
--- a/LongoMatch.Drawing/Widgets/CategoriesLabels.cs
+++ b/LongoMatch.Drawing/Widgets/CategoriesLabels.cs
@@ -46,7 +46,7 @@ namespace LongoMatch.Drawing.Widgets
 
                public void LoadProject (Project project, PlaysFilter filter)
                {
-                       Objects.Clear ();
+                       Clear ();
                        this.project = project;
                        this.filter = filter;
                        if (project != null) {
diff --git a/LongoMatch.Drawing/Widgets/Dashboard.cs b/LongoMatch.Drawing/Widgets/Dashboard.cs
index 8c1aaa9..f53e05d 100644
--- a/LongoMatch.Drawing/Widgets/Dashboard.cs
+++ b/LongoMatch.Drawing/Widgets/Dashboard.cs
@@ -188,10 +188,7 @@ namespace LongoMatch.Drawing.Widgets
 
                void LoadTemplate ()
                {
-                       foreach (CanvasObject co in Objects) {
-                               co.Dispose ();
-                       }
-                       Objects.Clear ();
+                       Clear ();
                        foreach (TagButton tag in template.CommonTags) {
                                TagObject to = new TagObject (tag);
                                to.ClickedEvent += HandleTaggerClickedEvent;
diff --git a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
index 289c750..29bc042 100644
--- a/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/PlaysTimeline.cs
@@ -49,7 +49,7 @@ namespace LongoMatch.Drawing.Widgets
                public void LoadProject (Project project, PlaysFilter filter)
                {
                        this.project = project;
-                       Objects.Clear ();
+                       Clear ();
                        categories.Clear ();
                        duration = project.Description.File.Duration;
                        widget.Height = project.Categories.List.Count * StyleConf.TimelineCategoryHeight;
diff --git a/LongoMatch.Drawing/Widgets/PositionTagger.cs b/LongoMatch.Drawing/Widgets/PositionTagger.cs
index fc094cd..645e19c 100644
--- a/LongoMatch.Drawing/Widgets/PositionTagger.cs
+++ b/LongoMatch.Drawing/Widgets/PositionTagger.cs
@@ -78,14 +78,14 @@ namespace LongoMatch.Drawing.Widgets
 
                public List<Point> Points {
                        set {
-                               Objects.Clear ();
+                               Clear ();
                                Objects.Add (new PositionObject (value, Background.Width, Background.Height));
                        }
                }
 
                public List<Play> Plays {
                        set {
-                               Objects.Clear ();
+                               Clear ();
                                foreach (Play p in value) {
                                        AddPlay (p);
                                }
diff --git a/LongoMatch.Drawing/Widgets/TimersTimeline.cs b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
index e8c94e0..4d8cb42 100644
--- a/LongoMatch.Drawing/Widgets/TimersTimeline.cs
+++ b/LongoMatch.Drawing/Widgets/TimersTimeline.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Drawing.Widgets
 
                public void LoadTimers (List<Timer> timers, Time duration, bool splitTimers = true)
                {
-                       Objects.Clear ();
+                       Clear ();
                        this.timers = new Dictionary<Timer, TimerTimeline> ();
                        this.duration = duration;
                        FillCanvas (timers, splitTimers);
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 8d4b551..c18bdbf 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -84,6 +84,7 @@ namespace LongoMatch.Gui.Component
                        buttonswidget.Destroy ();
                        timeline.Destroy ();
                        playspositionviewer1.Destroy ();
+                       teamtagger.Dispose ();
                        base.OnDestroyed ();
                }
 
diff --git a/LongoMatch.GUI/Gui/Component/Timeline.cs b/LongoMatch.GUI/Gui/Component/Timeline.cs
index 432a60a..5e142a8 100644
--- a/LongoMatch.GUI/Gui/Component/Timeline.cs
+++ b/LongoMatch.GUI/Gui/Component/Timeline.cs
@@ -69,6 +69,8 @@ namespace LongoMatch.Gui.Component
                protected override void OnDestroyed ()
                {
                        timerule.Dispose ();
+                       timeline.Dispose ();
+                       labels.Dispose ();
                        base.OnDestroyed ();
                }
                
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.CodingWidget.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.CodingWidget.cs
index 0d295f5..2108463 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.CodingWidget.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.CodingWidget.cs
@@ -5,11 +5,11 @@ namespace LongoMatch.Gui.Component
        public partial class CodingWidget
        {
                private global::Gtk.UIManager UIManager;
-               private global::Gtk.RadioAction positionMode;
                private global::Gtk.RadioAction timelineMode;
                private global::Gtk.RadioAction autoTaggingMode;
                private global::Gtk.Action zoomFitAction;
                private global::Gtk.RadioAction convertAction;
+               private global::Gtk.RadioAction positionMode;
                private global::Gtk.EventBox lightbackgroundeventbox;
                private global::Gtk.Notebook notebook;
                private global::Gtk.HPaned dashboardhpaned;
@@ -28,23 +28,23 @@ namespace LongoMatch.Gui.Component
                        // Widget LongoMatch.Gui.Component.CodingWidget
                        Stetic.BinContainer w1 = global::Stetic.BinContainer.Attach (this);
                        this.UIManager = new global::Gtk.UIManager ();
-                       global::Gtk.ActionGroup w2 = new global::Gtk.ActionGroup ("Timeline");
-                       this.positionMode = new global::Gtk.RadioAction ("positionMode", null, null, 
"gtk-justify-fill", 0);
-                       this.positionMode.Group = new global::GLib.SList (global::System.IntPtr.Zero);
-                       w2.Add (this.positionMode, null);
-                       this.UIManager.InsertActionGroup (w2, 0);
-                       global::Gtk.ActionGroup w3 = new global::Gtk.ActionGroup ("Default");
+                       global::Gtk.ActionGroup w2 = new global::Gtk.ActionGroup ("Default");
                        this.timelineMode = new global::Gtk.RadioAction ("timelineMode", null, 
global::Mono.Unix.Catalog.GetString ("Timeline view"), "gtk-justify-fill", 0);
-                       this.timelineMode.Group = this.positionMode.Group;
-                       w3.Add (this.timelineMode, null);
+                       this.timelineMode.Group = new global::GLib.SList (global::System.IntPtr.Zero);
+                       w2.Add (this.timelineMode, null);
                        this.autoTaggingMode = new global::Gtk.RadioAction ("autoTaggingMode", null, 
global::Mono.Unix.Catalog.GetString ("Automatic tagging view"), "gtk-select-color", 0);
                        this.autoTaggingMode.Group = this.timelineMode.Group;
-                       w3.Add (this.autoTaggingMode, null);
+                       w2.Add (this.autoTaggingMode, null);
                        this.zoomFitAction = new global::Gtk.Action ("zoomFitAction", null, null, 
"gtk-zoom-fit");
-                       w3.Add (this.zoomFitAction, null);
+                       w2.Add (this.zoomFitAction, null);
                        this.convertAction = new global::Gtk.RadioAction ("convertAction", null, null, 
"gtk-convert", 0);
                        this.convertAction.Group = this.timelineMode.Group;
-                       w3.Add (this.convertAction, null);
+                       w2.Add (this.convertAction, null);
+                       this.UIManager.InsertActionGroup (w2, 0);
+                       global::Gtk.ActionGroup w3 = new global::Gtk.ActionGroup ("Timeline");
+                       this.positionMode = new global::Gtk.RadioAction ("positionMode", null, null, 
"gtk-justify-fill", 0);
+                       this.positionMode.Group = this.timelineMode.Group;
+                       w3.Add (this.positionMode, null);
                        this.UIManager.InsertActionGroup (w3, 1);
                        this.Name = "LongoMatch.Gui.Component.CodingWidget";
                        // Container child LongoMatch.Gui.Component.CodingWidget.Gtk.Container+ContainerChild
@@ -54,7 +54,7 @@ namespace LongoMatch.Gui.Component
                        this.notebook = new global::Gtk.Notebook ();
                        this.notebook.CanFocus = true;
                        this.notebook.Name = "notebook";
-                       this.notebook.CurrentPage = 1;
+                       this.notebook.CurrentPage = 0;
                        this.notebook.TabPos = ((global::Gtk.PositionType)(0));
                        this.notebook.ShowBorder = false;
                        // Container child notebook.Gtk.Notebook+NotebookChild
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index f254238..598349b 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -9934,17 +9934,6 @@ You can continue with the current capture, cancel it or save your project.
     </child>
   </widget>
   <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.CodingWidget" design-size="1341 494">
-    <action-group name="Timeline">
-      <action id="positionMode">
-        <property name="Type">Radio</property>
-        <property name="Label" translatable="yes" />
-        <property name="StockId">gtk-justify-fill</property>
-        <property name="DrawAsRadio">False</property>
-        <property name="Active">False</property>
-        <property name="Value">0</property>
-        <property name="Group">codingmode</property>
-      </action>
-    </action-group>
     <action-group name="Default">
       <action id="timelineMode">
         <property name="Type">Radio</property>
@@ -9981,6 +9970,17 @@ You can continue with the current capture, cancel it or save your project.
         <property name="Group">codingmode</property>
       </action>
     </action-group>
+    <action-group name="Timeline">
+      <action id="positionMode">
+        <property name="Type">Radio</property>
+        <property name="Label" translatable="yes" />
+        <property name="StockId">gtk-justify-fill</property>
+        <property name="DrawAsRadio">False</property>
+        <property name="Active">False</property>
+        <property name="Value">0</property>
+        <property name="Group">codingmode</property>
+      </action>
+    </action-group>
     <property name="MemberName" />
     <property name="Visible">False</property>
     <child>
@@ -9990,7 +9990,7 @@ You can continue with the current capture, cancel it or save your project.
           <widget class="Gtk.Notebook" id="notebook">
             <property name="MemberName" />
             <property name="CanFocus">True</property>
-            <property name="CurrentPage">1</property>
+            <property name="CurrentPage">0</property>
             <property name="TabPos">Left</property>
             <property name="ShowBorder">False</property>
             <child>


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