This creates a destructor for ProfileWidget2 that deletetes its new'ed
objects on exit.

Signed-off-by: Anton Lundin <[email protected]>
---
 qt-ui/profile/profilewidget2.cpp | 31 +++++++++++++++++++++++++++++++
 qt-ui/profile/profilewidget2.h   |  1 +
 2 files changed, 32 insertions(+)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 348d75b..d631e3c 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -141,6 +141,37 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : 
QGraphicsView(parent),
 #endif
 }
 
+
+ProfileWidget2::~ProfileWidget2()
+{
+       delete background;
+       delete toolTipItem;
+       delete profileYAxis;
+       delete gasYAxis;
+       delete temperatureAxis;
+       delete timeAxis;
+       delete diveProfileItem;
+       delete temperatureItem;
+       delete cylinderPressureAxis;
+       delete gasPressureItem;
+       delete meanDepth;
+       delete diveComputerText;
+       delete diveCeiling;
+       delete reportedCeiling;
+       delete pn2GasItem;
+       delete pheGasItem;
+       delete po2GasItem;
+       delete heartBeatAxis;
+       delete heartBeatItem;
+       delete percentageAxis;
+       delete ambPressureItem;
+       delete gflineItem;
+       delete mouseFollowerVertical;
+       delete mouseFollowerHorizontal;
+       delete rulerItem;
+       delete tankItem;
+}
+
 #define SUBSURFACE_OBJ_DATA 1
 #define SUBSURFACE_OBJ_DC_TEXT 0x42
 
diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h
index 9808a96..5a612d9 100644
--- a/qt-ui/profile/profilewidget2.h
+++ b/qt-ui/profile/profilewidget2.h
@@ -120,6 +120,7 @@ slots: // Necessary to call from QAction's signals.
        void divePlannerHandlerClicked();
        void divePlannerHandlerReleased();
 protected:
+       virtual ~ProfileWidget2();
        virtual void resizeEvent(QResizeEvent *event);
        virtual void wheelEvent(QWheelEvent *event);
        virtual void mouseMoveEvent(QMouseEvent *event);
-- 
2.1.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to