From 319127c3305a73f855c1b6257efe1fad40b5f11c Mon Sep 17 00:00:00 2001 From: Collin Kidder Date: Mon, 18 Mar 2024 21:13:02 -0400 Subject: [PATCH] Fix issue where graph windows would be corrupted if a new file was loaded while graphs were visible. --- re/graphingwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/re/graphingwindow.cpp b/re/graphingwindow.cpp index d2f2581..80b32d5 100644 --- a/re/graphingwindow.cpp +++ b/re/graphingwindow.cpp @@ -1333,7 +1333,8 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) for (int i = 0; i < modelFrames->count(); i++) { CANFrame thisFrame = modelFrames->at(i); - if (thisFrame.frameId() == params.ID && thisFrame.frameType() == QCanBusFrame::DataFrame && ( ( params.bus == -1) || (params.bus == thisFrame.bus) ) ) frameCache.append(thisFrame); + if ( (thisFrame.frameId() == params.ID) && (thisFrame.frameType() == QCanBusFrame::DataFrame) + && ( ( params.bus == -1) || (params.bus == thisFrame.bus) ) ) frameCache.append(thisFrame); } //to fix weirdness where a graph that has no data won't be able to be edited, selected, or deleted properly @@ -1352,6 +1353,8 @@ void GraphingWindow::createGraph(GraphParams ¶ms, bool createGraphParam) int numEntries = frameCache.count() / params.stride; if (numEntries < 1) numEntries = 1; //could happen if stride is larger than frame count + params.x.clear(); + params.y.clear(); params.x.reserve(numEntries); params.y.reserve(numEntries); //params.x.fill(0, numEntries);