summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 8a4e0c8ffd..eee4aa546c 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -578,12 +578,22 @@ GLuint QOpenGLWidgetPrivate::textureId() const
void QOpenGLWidgetPrivate::reset()
{
+ Q_Q(QOpenGLWidget);
+
+ // Destroy the OpenGL resources first. These need the context to be current.
+ if (initialized)
+ q->makeCurrent();
+
delete paintDevice;
paintDevice = 0;
delete fbo;
fbo = 0;
delete resolvedFbo;
resolvedFbo = 0;
+
+ if (initialized)
+ q->doneCurrent();
+
// Delete the context first, then the surface. Slots connected to
// the context's aboutToBeDestroyed() may still call makeCurrent()
// to perform some cleanup.