[longomatch/newui: 53/157] Dispose correctly more objects
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/newui: 53/157] Dispose correctly more objects
- Date: Mon, 1 Sep 2014 09:45:49 +0000 (UTC)
commit cafb003e0be8fa8cb7093c5bce681c13a6b3d880
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Thu Aug 21 18:39:55 2014 +0200
Dispose correctly more objects
.../CanvasObjects/PlayersTaggerObject.cs | 43 +++++---------------
LongoMatch.Drawing/Widgets/TeamTagger.cs | 8 +++-
LongoMatch.GUI/Gui/Component/DashboardWidget.cs | 6 +-
LongoMatch.GUI/Gui/Component/ProjectPeriods.cs | 2 +
LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs | 6 +++
LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs | 1 +
LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs | 6 +++
LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs | 6 +++
8 files changed, 42 insertions(+), 36 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
b/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
index e769b09..2fd2680 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayersTaggerObject.cs
@@ -67,38 +67,17 @@ namespace LongoMatch.Drawing.CanvasObjects
protected override void Dispose (bool disposing)
{
ClearPlayers ();
- if (photoSurface != null) {
- photoSurface.Dispose ();
- photoSurface = null;
- }
- if (backgroundSurface != null) {
- backgroundSurface.Dispose ();
- backgroundSurface = null;
- }
- if (homeNumberSurface != null) {
- homeNumberSurface.Dispose ();
- homeNumberSurface = null;
- }
- if (awayNumberSurface != null) {
- awayNumberSurface.Dispose ();
- awayNumberSurface = null;
- }
- if (homeOutSurface != null) {
- homeOutSurface.Dispose ();
- homeOutSurface = null;
- }
- if (awayOutSurface != null) {
- awayOutSurface.Dispose ();
- awayOutSurface = null;
- }
- if (homeInSurface != null) {
- homeInSurface.Dispose ();
- homeInSurface = null;
- }
- if (awayInSurface != null) {
- awayInSurface.Dispose ();
- awayInSurface = null;
- }
+ homeBench.Dispose ();
+ awayBench.Dispose ();
+ field.Dispose ();
+ photoSurface.Dispose ();
+ backgroundSurface.Dispose ();
+ homeNumberSurface.Dispose ();
+ awayNumberSurface.Dispose ();
+ homeOutSurface.Dispose ();
+ awayOutSurface.Dispose ();
+ homeInSurface.Dispose ();
+ awayInSurface.Dispose ();
base.Dispose (disposing);
}
diff --git a/LongoMatch.Drawing/Widgets/TeamTagger.cs b/LongoMatch.Drawing/Widgets/TeamTagger.cs
index 1366916..c5aa763 100644
--- a/LongoMatch.Drawing/Widgets/TeamTagger.cs
+++ b/LongoMatch.Drawing/Widgets/TeamTagger.cs
@@ -49,8 +49,14 @@ namespace LongoMatch.Drawing.Widgets
ObjectsCanMove = false;
Objects.Add (tagger);
}
+
+ protected override void Dispose (bool disposing)
+ {
+ base.Dispose (disposing);
+ tagger.Dispose ();
+ }
- public void LoadTeams (TeamTemplate homeTeam, TeamTemplate awayTeam, Image background)
+ public void LoadTeams (TeamTemplate homeTeam, TeamTemplate awayTeam, Image background)
{
tagger.LoadTeams (homeTeam, awayTeam, background);
widget.ReDraw ();
diff --git a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
index a2dd0ab..626c822 100644
--- a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
@@ -72,13 +72,13 @@ namespace LongoMatch.Gui.Component
Edited = false;
}
- public override void Destroy ()
+ protected override void OnDestroyed ()
{
Config.EventsBroker.Tick -= HandleTick;
tagger.Dispose ();
- base.Destroy ();
+ base.OnDestroyed ();
}
-
+
public bool Edited {
get {
return edited || tagger.Edited || tagproperties.Edited;
diff --git a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
index 08e557d..75db06e 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectPeriods.cs
@@ -54,6 +54,8 @@ namespace LongoMatch.Gui.Component
protected override void OnDestroyed ()
{
playerbin2.Destroy ();
+ timerule.Dispose ();
+ timersTimenline.Dispose ();
base.OnDestroyed ();
}
diff --git a/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
b/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
index db8e4a6..fc49846 100644
--- a/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
+++ b/LongoMatch.GUI/Gui/Component/TeamTemplateEditor.cs
@@ -52,6 +52,12 @@ namespace LongoMatch.Gui.Component
teamtagger.PlayersSelectionChangedEvent += HandlePlayersSelectionChangedEvent;
ConnectSignals ();
}
+
+ protected override void OnDestroyed ()
+ {
+ teamtagger.Dispose ();
+ base.OnDestroyed ();
+ }
public bool Edited {
get {
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index b71f302..00c9dc5 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -96,6 +96,7 @@ namespace LongoMatch.Gui.Panel
protected override void OnDestroyed ()
{
+ teamtagger.Dispose ();
projectperiods1.Destroy ();
base.OnDestroyed ();
}
diff --git a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
index 8efd8c8..c854ff2 100644
--- a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
@@ -112,6 +112,12 @@ namespace LongoMatch.Gui.Panel
};
Load (null);
}
+
+ protected override void OnDestroyed ()
+ {
+ buttonswidget.Destroy ();
+ base.OnDestroyed ();
+ }
void Load (string templateName) {
TreeIter templateIter = TreeIter.Zero;
diff --git a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
index adca15c..a3044fe 100644
--- a/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/TeamsTemplatesPanel.cs
@@ -87,6 +87,12 @@ namespace LongoMatch.Gui.Panel
Load (null);
}
+
+ public override void Destroy ()
+ {
+ teamtemplateeditor1.Destroy ();
+ base.Destroy ();
+ }
void Load (string templateName)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]