[longomatch] Dispose stats after use
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Dispose stats after use
- Date: Sun, 11 Aug 2013 15:10:06 +0000 (UTC)
commit 2f566cea64818acb1325697a46be583f596c4dcd
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Aug 10 14:32:28 2013 +0200
Dispose stats after use
LongoMatch.Core/Stats/ProjectStats.cs | 11 ++++++++++-
LongoMatch.GUI/Gui/Dialog/StatsViewer.cs | 13 ++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/LongoMatch.Core/Stats/ProjectStats.cs b/LongoMatch.Core/Stats/ProjectStats.cs
index 47802c1..6debf46 100644
--- a/LongoMatch.Core/Stats/ProjectStats.cs
+++ b/LongoMatch.Core/Stats/ProjectStats.cs
@@ -26,7 +26,7 @@ using LongoMatch.Store.Templates;
namespace LongoMatch.Stats
{
- public class ProjectStats
+ public class ProjectStats: IDisposable
{
List<CategoryStats> catStats;
GameUnitsStats guStats;
@@ -46,6 +46,15 @@ namespace LongoMatch.Stats
UpdateGameUnitsStats (project);
}
+ public void Dispose () {
+ if (HalfField != null)
+ HalfField.Dispose ();
+ if (Field != null)
+ Field.Dispose ();
+ if (Goal != null)
+ Goal.Dispose ();
+ }
+
public string ProjectName {
set;
get;
diff --git a/LongoMatch.GUI/Gui/Dialog/StatsViewer.cs b/LongoMatch.GUI/Gui/Dialog/StatsViewer.cs
index b2893d2..1381c7d 100644
--- a/LongoMatch.GUI/Gui/Dialog/StatsViewer.cs
+++ b/LongoMatch.GUI/Gui/Dialog/StatsViewer.cs
@@ -23,13 +23,24 @@ namespace LongoMatch.Gui.Dialog
{
public partial class StatsViewer : Gtk.Dialog
{
+ ProjectStats stats;
+
public StatsViewer ()
{
this.Build ();
}
+ public override void Destroy ()
+ {
+ base.Destroy ();
+ if (stats != null)
+ stats.Dispose();
+ }
+
public void LoadStats (Project project) {
- ProjectStats stats = new ProjectStats (project);
+ if (stats != null)
+ stats.Dispose();
+ stats = new ProjectStats (project);
categoriesviewer.LoadStats (stats);
gameviewer.Project = project;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]