From c337cdf39cc249560bf9a5380e308d09a4c13b95 Mon Sep 17 00:00:00 2001 From: Even Oscar Andersen Date: Tue, 2 Jul 2024 16:41:33 +0200 Subject: Move destruction logic to QOpenGLWindow from Private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QOpenGLWindow has been destroyed when QOpenGLWindowPrivate destructor runs Fixes: QTBUG-126845 Pick-to: 6.8 Change-Id: I4f0208c4adf1a875cdcaca91fc239cf4e6200e4d Reviewed-by: Tor Arne Vestbø --- src/opengl/qopenglwindow.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/opengl/qopenglwindow.cpp') diff --git a/src/opengl/qopenglwindow.cpp b/src/opengl/qopenglwindow.cpp index a3677aa828b..6b74aaedd70 100644 --- a/src/opengl/qopenglwindow.cpp +++ b/src/opengl/qopenglwindow.cpp @@ -188,14 +188,6 @@ public: QOpenGLWindowPrivate::~QOpenGLWindowPrivate() { - Q_Q(QOpenGLWindow); - if (q->isValid()) { - q->makeCurrent(); // this works even when the platformwindow is destroyed - paintDevice.reset(nullptr); - fbo.reset(nullptr); - blitter.destroy(); - q->doneCurrent(); - } } void QOpenGLWindowPrivate::initialize() @@ -367,7 +359,15 @@ QOpenGLWindow::QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior update */ QOpenGLWindow::~QOpenGLWindow() { - makeCurrent(); + Q_D(QOpenGLWindow); + + makeCurrent(); // this works even when the platformwindow is destroyed + if (isValid()) { + d->paintDevice.reset(nullptr); + d->fbo.reset(nullptr); + d->blitter.destroy(); + } + doneCurrent(); } /*! -- cgit v1.2.3