From 19fbc108c3359cafb9ac76bca20df68fc58624a2 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 27 Jun 2013 17:31:10 -0300 Subject: Removed memleak created by the diveplan calculations Removed a small memleak created by the diveplan calculations. Signed-off-by: Tomaz Canabrava --- qt-ui/diveplanner.cpp | 10 ++++++++++ qt-ui/diveplanner.h | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index a8f45d91f..1aaf5aa7d 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -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) diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index f2073515d..09418f1c6 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -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 lines; QList handles; -- cgit v1.2.3-70-g09d2