From: jpbruyere Date: Wed, 19 Apr 2017 10:37:40 +0000 (+0200) Subject: clear datasource when removing obj from graphic tree X-Git-Tag: v0.9.5-beta~225 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=07fe679697a603cc230be21f8990dbbc4eb59912;p=jp%2Fcrow.git clear datasource when removing obj from graphic tree --- diff --git a/src/Interface.cs b/src/Interface.cs index 9e5175fb..8439c31e 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -572,13 +572,15 @@ namespace Crow /// Set visible state of widget to false and remove if from the graphic tree public void DeleteWidget(GraphicObject g) { - g.Visible = false;//trick to ensure clip is added to refresh zone if (_hoverWidget != null) { if (g.Contains (_hoverWidget)) HoverWidget = null; } - lock (UpdateMutex) + lock (UpdateMutex) { + g.DataSource = null; + g.Visible = false; GraphicTree.Remove (g); + } } /// Put widget on top of other root widgets public void PutOnTop(GraphicObject g, bool isOverlay = false) @@ -607,12 +609,11 @@ namespace Crow /// Remove all Graphic objects from top container public void ClearInterface() { - int i = 0; lock (UpdateMutex) { while (GraphicTree.Count > 0) { //TODO:parent is not reset to null because object will be added //to ObjectToRedraw list, and without parent, it fails - GraphicObject g = GraphicTree [i]; + GraphicObject g = GraphicTree [0]; g.DataSource = null; g.Visible = false; GraphicTree.RemoveAt (0); @@ -625,6 +626,7 @@ namespace Crow curLQIs = new LQIList(); #endif } + /// Search a Graphic object in the tree named 'nameToFind' public GraphicObject FindByName (string nameToFind) {