diff options
author | Tang Haixiang <tanghaixiang@uniontech.com> | 2021-10-21 16:32:59 +0800 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-11-04 01:03:44 +0000 |
commit | c4856a9075c0a824e7614af621d6785759a3d5f5 (patch) | |
tree | b12ca2833c1ae73777797e9c9c65f10318b8e5b4 /examples | |
parent | f5fbad669d8b9b7284d8644ae51098a9c1998f64 (diff) |
Use QScopedPointer to manage memory
Although the QBackingStore constructor takes a QWindow* as a parameter,
it does not inherit QObject and doesn't become a QObject child of the
QWindow. Use QScopedPointer to avoid memory leaks.
Pick-to: 6.2
Change-Id: Ib065163a9149d002f8220a0257bd78549062c595
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gui/rasterwindow/rasterwindow.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/gui/rasterwindow/rasterwindow.h b/examples/gui/rasterwindow/rasterwindow.h index 58c3ab89b2..279952cf61 100644 --- a/examples/gui/rasterwindow/rasterwindow.h +++ b/examples/gui/rasterwindow/rasterwindow.h @@ -53,6 +53,7 @@ //! [1] #include <QtGui> +#include <QScopedPointer> class RasterWindow : public QWindow { @@ -73,7 +74,7 @@ protected: void exposeEvent(QExposeEvent *event) override; private: - QBackingStore *m_backingStore; + QScopedPointer<QBackingStore> m_backingStore; }; //! [1] #endif // RASTERWINDOW_H |