aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/Interface.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-04-19 12:37:40 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2017-04-19 12:37:40 +0200
commit07fe679697a603cc230be21f8990dbbc4eb59912 (patch)
treef1f4a138bff8fdee2c18daa22698ace17d4ed3c6 /src/Interface.cs
parent3ac2511698deed3c0fde54d6fcec64f9162b5cd0 (diff)
clear datasource when removing obj from graphic tree
Diffstat (limited to 'src/Interface.cs')
-rw-r--r--src/Interface.cs10
1 files changed, 6 insertions, 4 deletions
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
/// <summary>Set visible state of widget to false and remove if from the graphic tree</summary>
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);
+ }
}
/// <summary> Put widget on top of other root widgets</summary>
public void PutOnTop(GraphicObject g, bool isOverlay = false)
@@ -607,12 +609,11 @@ namespace Crow
/// <summary> Remove all Graphic objects from top container </summary>
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
}
+
/// <summary>Search a Graphic object in the tree named 'nameToFind'</summary>
public GraphicObject FindByName (string nameToFind)
{