summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget_p.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-05-24 22:06:09 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-08-16 05:19:04 +0000
commit70c624d93ee040e8aa4ab576be008f07bbfb8a2e (patch)
treee2666cc681dc1f42da422a383b00bd3a9892e9ed /src/widgets/kernel/qwidget_p.h
parent45c5cc619933d1283da27a15d5d7ab3d2e8e5329 (diff)
QWidget: replace manual memory management with unique_ptr [5/N]: extra->topextra
It is a bit frustrating that all the initialization and cleanup code are not in the QTLWExtra ctor and dtor. But that is for another patch. Change-Id: I0e45f89c1a53eb2f9a5699d3fbbef1a628b55432 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/widgets/kernel/qwidget_p.h')
-rw-r--r--src/widgets/kernel/qwidget_p.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 03b09f2ca8..c851072c11 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -239,7 +239,7 @@ struct QWExtra {
// Regular pointers (keep them together to avoid gaps on 64 bits architectures).
void *glContext; // if the widget is hijacked by QGLWindowSurface
- QTLWExtra *topextra; // only useful for TLWs
+ std::unique_ptr<QTLWExtra> topextra; // only useful for TLWs
#if QT_CONFIG(graphicsview)
QGraphicsProxyWidget *proxyWidget; // if the widget is embedded
#endif
@@ -993,12 +993,12 @@ inline QWExtra *QWidgetPrivate::extraData() const
inline QTLWExtra *QWidgetPrivate::topData() const
{
const_cast<QWidgetPrivate *>(this)->createTLExtra();
- return extra->topextra;
+ return extra->topextra.get();
}
inline QTLWExtra *QWidgetPrivate::maybeTopData() const
{
- return extra ? extra->topextra : nullptr;
+ return extra ? extra->topextra.get() : nullptr;
}
inline QPainter *QWidgetPrivate::sharedPainter() const