Avoid crash in QVertexArrayObject destructor

Change-Id: If43c7b1cfdee504171a26b07db2ade9c20528299
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Sean Harmer 2013-03-11 14:20:04 +00:00 committed by The Qt Project
parent 771286e01e
commit b80d130a51

View File

@ -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;