[longomatch] Fix exception triggered by redraws in the finalizer



commit e6fc67adbe7eece56bdaf2d99878bf37eb51449d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Mar 16 15:30:37 2015 +0100

    Fix exception triggered by redraws in the finalizer

 LongoMatch.Drawing/Canvas.cs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Drawing/Canvas.cs b/LongoMatch.Drawing/Canvas.cs
index affce58..a272085 100644
--- a/LongoMatch.Drawing/Canvas.cs
+++ b/LongoMatch.Drawing/Canvas.cs
@@ -32,6 +32,7 @@ namespace LongoMatch.Drawing
                protected IWidget widget;
                protected double scaleX, scaleY;
                protected Point translation;
+               protected bool ignoreRedraws;
                bool disposed;
 
                public Canvas (IWidget widget)
@@ -63,6 +64,7 @@ namespace LongoMatch.Drawing
                protected virtual void Dispose (bool disposing)
                {
                        // FIXME: Should we check if we are disposed already ?
+                       ignoreRedraws = true;
                        if (disposing) {
                                ClearObjects ();
                                Objects = null;
@@ -107,7 +109,9 @@ namespace LongoMatch.Drawing
 
                void HandleRedrawEvent (ICanvasObject co, Area area)
                {
-                       widget.ReDraw (area);
+                       if (!ignoreRedraws) {
+                               widget.ReDraw (area);
+                       }
                }
 
                void HandleSizeChangedEvent ()


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