diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2016-03-31 21:15:30 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2016-04-01 19:10:14 +0000 |
commit | fc65b9a7cbed3fe66e3037501b56949bc1d3ae30 (patch) | |
tree | ede50002dbef6decdd99581dfe1a3eb56624a47c /src/widgets/graphicsview/qgraphicsgridlayout.cpp | |
parent | b7c7beacda529edd642d979064748bdad27b989b (diff) |
QGraphics*Layout: fix memory leaks
Change-Id: I5f9d2ccc8912e3fa08e376b5f6b6450d22913406
Task-number: QTBUG-10768
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/graphicsview/qgraphicsgridlayout.cpp')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsgridlayout.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp index 6f65558a1a..2dc84a5399 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp @@ -83,6 +83,7 @@ #include "qgraphicswidget.h" #include "qgraphicsgridlayoutengine_p.h" #include "qgraphicslayoutstyleinfo_p.h" +#include "qscopedpointer.h" #ifdef QT_DEBUG # include <QtCore/qdebug.h> #endif @@ -92,10 +93,10 @@ QT_BEGIN_NAMESPACE class QGraphicsGridLayoutPrivate : public QGraphicsLayoutPrivate { public: - QGraphicsGridLayoutPrivate(): m_styleInfo(0) { } + QGraphicsGridLayoutPrivate() { } QGraphicsLayoutStyleInfo *styleInfo() const; - mutable QGraphicsLayoutStyleInfo *m_styleInfo; + mutable QScopedPointer<QGraphicsLayoutStyleInfo> m_styleInfo; QGraphicsGridLayoutEngine engine; #ifdef QGRIDLAYOUTENGINE_DEBUG @@ -107,8 +108,8 @@ public: QGraphicsLayoutStyleInfo *QGraphicsGridLayoutPrivate::styleInfo() const { if (!m_styleInfo) - m_styleInfo = new QGraphicsLayoutStyleInfo(this); - return m_styleInfo; + m_styleInfo.reset(new QGraphicsLayoutStyleInfo(this)); + return m_styleInfo.data(); } /*! |