From 70c624d93ee040e8aa4ab576be008f07bbfb8a2e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 24 May 2019 22:06:09 +0200 Subject: QWidget: replace manual memory management with unique_ptr [5/N]: extra->topextra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Edward Welbourne Reviewed-by: MÃ¥rten Nordheim --- src/widgets/kernel/qwidget_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets/kernel/qwidget_p.h') 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 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(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 -- cgit v1.2.3