diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-05-24 22:06:09 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-08-16 07:18:57 +0200 |
commit | 19ccbdabfe889fccd67ab162bbb144846ab098fb (patch) | |
tree | a2f0b5dedf13ac5bc8b7ed767d5de7db2370cebd /src/widgets/kernel/qwidget_p.h | |
parent | e3663b65a754e4b2c827b0bbb89418ff97cf3199 (diff) |
QWidget: replace manual memory management with unique_ptr [3/N]: topextra->shareContext
Despite the name, it's fully owned by an individual QWidget object.
Also make the member mutable, so we can remove the const_cast hack in
QWidgetPrivate::shareContext(), and protect QT_NO_OPENGL builds, since
the naked pointer compiled by chance due to some unguarded forward
declarations while a unique_ptr will somewhere want to call the dtor,
which doesn't compile on an object of merely forward-declared type.
Change-Id: If8027b55d303822236fcdc1a79e4f3010967b4d2
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.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 435aae2950..b43489a98f 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -169,7 +169,9 @@ struct QTLWExtra { QBackingStore *backingStore; QPainter *sharedPainter; QWidgetWindow *window; - QOpenGLContext *shareContext; +#ifndef QT_NO_OPENGL + mutable std::unique_ptr<QOpenGLContext> shareContext; +#endif // Implicit pointers (shared_null). QString caption; // widget caption |