Move destruction logic to QOpenGLWindow from Private

QOpenGLWindow has been destroyed when QOpenGLWindowPrivate
destructor runs

Fixes: QTBUG-126845
Change-Id: I4f0208c4adf1a875cdcaca91fc239cf4e6200e4d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c337cdf39cc249560bf9a5380e308d09a4c13b95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Even Oscar Andersen 2024-07-02 16:41:33 +02:00 committed by Qt Cherry-pick Bot
parent fe284006b2
commit 52c9346f5b

View File

@ -188,14 +188,6 @@ public:
QOpenGLWindowPrivate::~QOpenGLWindowPrivate() 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() void QOpenGLWindowPrivate::initialize()
@ -367,7 +359,15 @@ QOpenGLWindow::QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior update
*/ */
QOpenGLWindow::~QOpenGLWindow() 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();
} }
/*! /*!