From 581d10bdf26dacaa36a916744ff5b43ecaa05f77 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 1 Apr 2014 14:18:15 +0200 Subject: Avoid recreating the underlying context in QGLContext wrappers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/opengl/qgl.cpp | 5 +++-- 1 file 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 -- cgit v1.2.3