From b80d130a5192a15eb53592b31e05be7cbee2c1ef Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Mon, 11 Mar 2013 14:20:04 +0000 Subject: Avoid crash in QVertexArrayObject destructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If43c7b1cfdee504171a26b07db2ade9c20528299 Reviewed-by: Samuel Rødal Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglvertexarrayobject.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index 7f130505ec..e450fe708f 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -146,6 +146,7 @@ bool QOpenGLVertexArrayObjectPrivate::create() qWarning("QOpenGLVertexArrayObject::create() requires a valid current OpenGL context"); return false; } + context = ctx; #if defined(QT_OPENGL_ES_2) if (ctx->hasExtension("GL_OES_vertex_array_object")) { @@ -326,7 +327,7 @@ QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() Q_D(QOpenGLVertexArrayObject); QOpenGLContext *oldContext = 0; - if (d->context != ctx) { + if (d->context && d->context != ctx) { oldContext = ctx; if (d->context->makeCurrent(oldContext->surface())) { ctx = d->context; -- cgit v1.2.3