diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-04-01 14:18:15 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-03 14:18:41 +0200 |
commit | 581d10bdf26dacaa36a916744ff5b43ecaa05f77 (patch) | |
tree | 7ae213a1a063913e8fd64d2c4426a625ae5db551 | |
parent | e39f30a0d27608cf112f818f2c63418bfeb93cb3 (diff) |
Avoid recreating the underlying context in QGLContext wrappers
QGLContexts created from a QOpenGLContext get their valid flag reset,
resulting in creating a totally new underlying context. This is wrong
and becomes visible when sharing is expected between contexts (since the
QGLContext's underlying QOpenGLContext will not have sharing).
Task-number: QTBUG-37893
Change-Id: I8cb37c11dfb400a77e510bf4c8219bedc742309e
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
-rw-r--r-- | src/opengl/qgl.cpp | 5 |
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 |