Fixes a double free regression caused by #1139
This commit is contained in:
ivandi 2024-12-16 21:02:12 -05:00
parent f152ee25ce
commit c74ae467e8
2 changed files with 8 additions and 2 deletions

View File

@ -859,7 +859,10 @@ int Graph::loadDatFile(const QString &fileName) {
qDeleteAll(g->mutable_axes());
g->mutable_axes().clear();
g->countY = 0;
delete[] g->cPointsY;
if (g->cPointsY != nullptr) {
delete[] g->cPointsY;
g->cPointsY = nullptr;
}
if (Variable.isEmpty()) return 0;
#if 0 // FIXME encapsulation. implement digital waves later.

View File

@ -48,8 +48,11 @@ Graph::Graph(Diagram const* d, const QString& _Line) :
Graph::~Graph()
{
if (cPointsY != nullptr) {
delete[] cPointsY;
qDeleteAll(cPointsX);
cPointsY = nullptr;
}
qDeleteAll(cPointsX);
}
// ---------------------------------------------------------------------