From ba88a3358d2e8ed6b5486fff4c11bbef785ee959 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 30 Nov 2013 09:18:02 -0800 Subject: Fix memory leak of the MinMaxAvgWidgetPrivate Found by Dr. Memory, run by Lubomir: Error #63: LEAK 24 direct bytes 0x344f42e8-0x344f4300 + 0 indirect bytes # 0 replace_operator_new [d:\drmemory_package\common\alloc_replace.c:2421] # 1 MinMaxAvgWidget::MinMaxAvgWidget() [qt-ui/simplewidgets.cpp:64] Signed-off-by: Thiago Macieira Signed-off-by: Dirk Hohndel --- qt-ui/simplewidgets.cpp | 6 +++++- qt-ui/simplewidgets.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 692cda1a1..006e790bf 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -61,7 +61,11 @@ double MinMaxAvgWidget::minimum() const } MinMaxAvgWidget::MinMaxAvgWidget(QWidget* parent) -: d(new MinMaxAvgWidgetPrivate(this)){ + : d(new MinMaxAvgWidgetPrivate(this)){ +} + +MinMaxAvgWidget::~MinMaxAvgWidget() +{ } void MinMaxAvgWidget::clear() diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h index 70d61ca59..c924370c5 100644 --- a/qt-ui/simplewidgets.h +++ b/qt-ui/simplewidgets.h @@ -17,6 +17,7 @@ class MinMaxAvgWidget : public QWidget{ Q_PROPERTY(double average READ average WRITE setAverage) public: MinMaxAvgWidget(QWidget *parent); + ~MinMaxAvgWidget(); double minimum() const; double maximum() const; double average() const; @@ -28,7 +29,7 @@ public: void setAverage(const QString& average); void clear(); private: - MinMaxAvgWidgetPrivate *d; + QScopedPointer d; }; class RenumberDialog : public QDialog { -- cgit v1.2.3-70-g09d2