[glass] Fix PlotSeries::SetSource() (#3991)

This can be called in a delayed manner, so it's possible for
m_size to already be at maximum, which results in writing past
the end of the array. Instead, just call AppendValue().
This commit is contained in:
Peter Johnson
2022-02-04 20:47:11 -08:00
committed by GitHub
parent 6a6366b0d6
commit bca4b7111b

View File

@@ -246,7 +246,7 @@ void PlotSeries::SetSource(DataSource* source) {
m_source = source;
// add initial value
m_data[m_size++] = ImPlotPoint{wpi::Now() * 1.0e-6, source->GetValue()};
AppendValue(source->GetValue(), 0);
m_newValueConn = source->valueChanged.connect_connection(
[this](double value, uint64_t time) { AppendValue(value, time); });