diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-23 11:57:32 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-03-25 13:10:49 +0000 |
commit | 076440704009ee7566f02fe95a36a16ce4e2fab3 (patch) | |
tree | 8601f69983b080d84afda4f2893ea11221a90c37 /src | |
parent | dc62f15d799440f57954bea61e14669ff2990149 (diff) |
Avoid crashing in the vao when not supported
The stored context pointer has to be reset to null in
destroy() even when no VAO was created (vao is null).
Otherwise destroying the context that was stored in the VAO
will not lead to resetting the stored pointer, and a subsequent
destruction of the VAO object will try to dereference it.
Task-number: QTBUG-44562
Change-Id: I438bb3954d4bbd8b8d8704f6087479804f0073a7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/opengl/qopenglvertexarrayobject.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index 6b0f2fede7..2a1b7f4bf4 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -189,11 +189,16 @@ bool QOpenGLVertexArrayObjectPrivate::create() void QOpenGLVertexArrayObjectPrivate::destroy() { + Q_Q(QOpenGLVertexArrayObject); + + if (context) { + QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); + context = 0; + } + if (!vao) return; - Q_Q(QOpenGLVertexArrayObject); - switch (vaoFuncsType) { #ifndef QT_OPENGL_ES_2 case Core_3_2: @@ -212,10 +217,6 @@ void QOpenGLVertexArrayObjectPrivate::destroy() break; } - Q_ASSERT(context); - QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); - context = 0; - vao = 0; } |