summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-03-26 14:10:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 17:51:21 +0100
commit98e90f700a22bf7f139e4993cc96fa91f1183131 (patch)
treeb8a25ba7756f4198620e4352baef7e651267967e
parent666c25c089acf7fcc9e9a6b7665074c6286d604e (diff)
Keep track of destroyed QOpenGLContexts in QOpenGLVertexArrayObject
QOpenGLVertexArrayObject saved the QOpenGLContext it was created in at the point of QOpenGLVertexArrayObjectPrivate::create(), but didn't set the saved context back to 0 in QOpenGLVertexArrayObjectPrivate::destroy(). The result was that the zero-pointer checks in the VAO destructor never hit, and we ended up trying to make a destroyed QOpenGLContext current. This bug was triggered by the QFontEngine having a limit of 4 concurrent glyph caches, so when we created the fifth glyph cache we would remove an earlier one, which destroyed its VOA, that referenced a QOpenGLContext for a window that had been destroyed already. We now reset the context back to 0, and disconnect aboutToBeDestroyed() at the point of QOpenGLVertexArrayObjectPrivate::destroy(). Change-Id: Ib16f3877b310144886cf863b16697c137e7c7941 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index b1fd4ffdfe..22ca35a8c3 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -149,8 +149,6 @@ bool QOpenGLVertexArrayObjectPrivate::create()
}
Q_Q(QOpenGLVertexArrayObject);
- if (context)
- QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (!ctx) {
@@ -202,6 +200,8 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
if (!vao)
return;
+ Q_Q(QOpenGLVertexArrayObject);
+
switch (vaoFuncsType) {
#ifndef QT_OPENGL_ES_2
case Core_3_2:
@@ -220,6 +220,10 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
break;
}
+ Q_ASSERT(context);
+ QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
+ context = 0;
+
vao = 0;
}