From bbb420280494708deccbca62a54324c2dfcb6f85 Mon Sep 17 00:00:00 2001 From: Pratik Gaikwad Date: Sat, 15 Sep 2018 11:21:06 -0400 Subject: [PATCH] chore(frameview removall): To avoid infitinte loop for removeall For Frameview, `contentView` is the first and only subview. In case of `RemoveAll`, `contentView` was sent from `View.RemoveAll` to overridden `Remove` function in `FrameView` Hence, `contentView` is trying to remove itself from itself thereby actually not removing any subviews as well `contentView` from `FrameView` parent. And thus the code was going in an infinite loop Added overridden `RemoveAll` which would call `View.RemoveAll` on `contentView` to remove all the subviews from `contentView` but not the `contentView` from `FrameView`. > Fixes: https://github.com/migueldeicaza/gui.cs/issues/125 --- Terminal.Gui/Views/FrameView.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Terminal.Gui/Views/FrameView.cs b/Terminal.Gui/Views/FrameView.cs index 518a843b8..c38c6f3ff 100644 --- a/Terminal.Gui/Views/FrameView.cs +++ b/Terminal.Gui/Views/FrameView.cs @@ -101,6 +101,16 @@ namespace Terminal.Gui { this.CanFocus = false; } + /// + /// Removes all widgets from this container. + /// + /// + /// + public override void RemoveAll() + { + contentView.RemoveAll(); + } + public override void Redraw (Rect bounds) { if (!NeedDisplay.IsEmpty) {