Fix issue where graph windows would be corrupted if a new file was

loaded while graphs were visible.
This commit is contained in:
Collin Kidder
2024-03-18 21:13:02 -04:00
parent 47a5aa5085
commit 319127c330
+4 -1
View File
@@ -1333,7 +1333,8 @@ void GraphingWindow::createGraph(GraphParams &params, 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 &params, 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);