Prevent concurrent access errors when iterating over news events during rendering
This commit is contained in:
parent
ccb420e519
commit
20768cebac
@ -234,7 +234,7 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
// Draw news events.
|
// Draw news events.
|
||||||
using (TextFormat eventTextFormat = EventFont.ToDirectWriteTextFormat())
|
using (TextFormat eventTextFormat = EventFont.ToDirectWriteTextFormat())
|
||||||
{
|
{
|
||||||
foreach (var newsEvent in newsEvents)
|
foreach (var newsEvent in new List<NewsEvent>(newsEvents))
|
||||||
{
|
{
|
||||||
var timeSize = MeasureString(newsEvent.Time, eventTextFormat);
|
var timeSize = MeasureString(newsEvent.Time, eventTextFormat);
|
||||||
var currencySize = MeasureString(newsEvent.Currency, eventTextFormat);
|
var currencySize = MeasureString(newsEvent.Currency, eventTextFormat);
|
||||||
|
Loading…
Reference in New Issue
Block a user