Removed memleak created by the diveplan calculations

Removed a small memleak created by the diveplan calculations.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-06-27 17:31:10 -03:00
parent c7c5ca7c3e
commit 19fbc108c3
2 changed files with 11 additions and 2 deletions

View file

@ -195,6 +195,16 @@ void DivePlannerGraphics::createDecoStops()
scene()->addItem(item);
lines << item;
}
deleteTemporaryDivePlan(diveplan.dp);
}
void DivePlannerGraphics::deleteTemporaryDivePlan(divedatapoint* dp)
{
if (!dp)
return;
deleteTemporaryDivePlan(dp->next);
free(dp);
}
void DivePlannerGraphics::resizeEvent(QResizeEvent* event)

View file

@ -68,7 +68,7 @@ protected:
void clearGeneratedDeco();
void createDecoStops();
bool isPointOutOfBoundaries(const QPointF& point);
void deleteTemporaryDivePlan(struct divedatapoint* dp);
private slots:
void increaseTime();
void increaseDepth();
@ -76,7 +76,6 @@ private slots:
void cancelClicked();
private:
void moveActiveHandler(const QPointF& pos);
QList<QGraphicsLineItem*> lines;
QList<DiveHandler *> handles;