aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-27 17:31:10 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-06-27 17:31:10 -0300
commit19fbc108c3359cafb9ac76bca20df68fc58624a2 (patch)
treeb69bb2abddba7f4f9c6dc9bd1ca2c7144f09e6a7
parentc7c5ca7c3e1f4f9fb3d6a49a4b6eb2bcfdf2fb24 (diff)
downloadsubsurface-19fbc108c3359cafb9ac76bca20df68fc58624a2.tar.gz
Removed memleak created by the diveplan calculations
Removed a small memleak created by the diveplan calculations. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/diveplanner.cpp10
-rw-r--r--qt-ui/diveplanner.h3
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<QGraphicsLineItem*> lines;
QList<DiveHandler *> handles;