diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2016-07-19 14:56:06 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2016-07-20 15:58:46 +0000 |
commit | 2b9b9a38e7273f640b6d1f3e174e8204cf7d81dd (patch) | |
tree | d28d5d15f82039252fe7ed570dcbf129a76f1394 /src/gui/opengl | |
parent | e6034a4740756334317ab2445b518a645930f4f4 (diff) |
QOpenGLVertexArrayObject: clean up the destructor
Calling QOpenGLContext::surface() on a non-current context will
likely return NULL, so the code path that tried to reset
the old context as current would actually fail.
Change-Id: Ibbc8da877740a596aa7dd0af8ccffb9a1877290a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r-- | src/gui/opengl/qopenglvertexarrayobject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index 2a1b7f4bf4..33c38519cc 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -352,9 +352,11 @@ QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() Q_D(QOpenGLVertexArrayObject); QOpenGLContext *oldContext = 0; + QSurface *oldContextSurface = 0; QScopedPointer<QOffscreenSurface> offscreenSurface; if (d->context && ctx && d->context != ctx) { oldContext = ctx; + oldContextSurface = ctx->surface(); // Cannot just make the current surface current again with another context. // The format may be incompatible and some platforms (iOS) may impose // restrictions on using a window with different contexts. Create an @@ -374,7 +376,7 @@ QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() destroy(); if (oldContext) { - if (!oldContext->makeCurrent(oldContext->surface())) + if (!oldContext->makeCurrent(oldContextSurface)) qWarning("QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() failed to restore current context"); } } |