diff options
| author | j-p <jp.bruyere@live.be> | 2017-08-28 05:12:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-28 05:12:19 +0200 |
| commit | 1d9aa6aa61da3dd5f1a1a488018ceb8b5a88f2af (patch) | |
| tree | e7e9aed2ad7b0947855ce9d70a52267b128fec0c /src/GraphicObjects/Group.cs | |
| parent | d6d7eda88ae12d6c47d6c158a5a9527a47447745 (diff) | |
full IDisposable implementation (#34)
* full implementation of IDisposable, not stable, lock and still leaking
* override dispose in popper to handle _content not yet in graphic tree (when never shown), test focusedWidget when disposing
* prevent canceling thread multiple times causing a deadlock
* test parent type when trying to close window
Diffstat (limited to 'src/GraphicObjects/Group.cs')
| -rw-r--r-- | src/GraphicObjects/Group.cs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index f3026290..e7d7d4d4 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -73,13 +73,9 @@ namespace Crow public virtual void RemoveChild(GraphicObject child) { child.LayoutChanged -= OnChildLayoutChanges; - child.Parent = null; //check if HoverWidget is removed from Tree - if (currentInterface.HoverWidget != null) { - if (currentInterface.HoverWidget.IsInside(this)) - currentInterface.HoverWidget = null; - } + lock (children) Children.Remove(child); @@ -366,11 +362,13 @@ namespace Crow } #endregion - public override void Dispose () + protected override void Dispose (bool disposing) { - foreach (GraphicObject c in children) - c.Dispose (); - base.Dispose (); + if (disposing) { + foreach (GraphicObject c in children) + c.Dispose (); + } + base.Dispose (disposing); } } } |