summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 637cfc55a8..3cfdcc549c 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2934,8 +2934,9 @@ void QGLContext::setFormat(const QGLFormat &format)
void QGLContext::setDevice(QPaintDevice *pDev)
{
Q_D(QGLContext);
- if (isValid())
- reset();
+ // Do not touch the valid flag here. The context is either a new one and
+ // valid is not yet set or it is adapted from a valid QOpenGLContext in which
+ // case it must remain valid.
d->paintDevice = pDev;
if (d->paintDevice && (d->paintDevice->devType() != QInternal::Widget
&& d->paintDevice->devType() != QInternal::Pixmap