summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopenglwindow.cpp
diff options
context:
space:
mode:
authorEven Oscar Andersen <[email protected]>2024-07-02 16:41:33 +0200
committerTor Arne Vestbø <[email protected]>2024-07-04 08:09:14 +0000
commitc337cdf39cc249560bf9a5380e308d09a4c13b95 (patch)
treea3737c8122a50ad249be18ef9a42323ddac5c4d1 /src/opengl/qopenglwindow.cpp
parent2fbece8a73cb2d2692c78c38e1576c0c9c62fce7 (diff)
Move destruction logic to QOpenGLWindow from Private
QOpenGLWindow has been destroyed when QOpenGLWindowPrivate destructor runs Fixes: QTBUG-126845 Pick-to: 6.8 Change-Id: I4f0208c4adf1a875cdcaca91fc239cf4e6200e4d Reviewed-by: Tor Arne Vestbø <[email protected]>
Diffstat (limited to 'src/opengl/qopenglwindow.cpp')
-rw-r--r--src/opengl/qopenglwindow.cpp18
1 files changed, 9 insertions, 9 deletions
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();
}
/*!