From deebed50687c51fcb1275ef12e7099b4810cc146 Mon Sep 17 00:00:00 2001 From: Thomas Nind Date: Wed, 26 May 2021 11:51:04 +0100 Subject: [PATCH] Fix bug where series/annotations are added during render --- Terminal.Gui/Views/GraphView.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Terminal.Gui/Views/GraphView.cs b/Terminal.Gui/Views/GraphView.cs index f80c20384..f012f7cd3 100644 --- a/Terminal.Gui/Views/GraphView.cs +++ b/Terminal.Gui/Views/GraphView.cs @@ -115,7 +115,7 @@ namespace Terminal.Gui { } // Draw 'before' annotations - foreach (var a in Annotations.Where (a => a.BeforeSeries)) { + foreach (var a in Annotations.ToArray().Where (a => a.BeforeSeries)) { a.Render (this); } @@ -141,7 +141,7 @@ namespace Terminal.Gui { Rect drawBounds = new Rect((int)MarginLeft,0, Bounds.Width - ((int)MarginLeft), Bounds.Height - (int)MarginBottom); RectangleF graphSpace = ScreenToGraphSpace (drawBounds); - foreach (var s in Series) { + foreach (var s in Series.ToArray ()) { s.DrawSeries (this, drawBounds, graphSpace); @@ -152,7 +152,7 @@ namespace Terminal.Gui { SetDriverColorToGraphColor (); // Draw 'after' annotations - foreach (var a in Annotations.Where (a => !a.BeforeSeries)) { + foreach (var a in Annotations.ToArray ().Where (a => !a.BeforeSeries)) { a.Render (this); }