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>
This commit is contained in:
parent
666c25c089
commit
98e90f700a
@ -149,8 +149,6 @@ bool QOpenGLVertexArrayObjectPrivate::create()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Q_Q(QOpenGLVertexArrayObject);
|
Q_Q(QOpenGLVertexArrayObject);
|
||||||
if (context)
|
|
||||||
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
|
||||||
|
|
||||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
@ -202,6 +200,8 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
|||||||
if (!vao)
|
if (!vao)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Q_Q(QOpenGLVertexArrayObject);
|
||||||
|
|
||||||
switch (vaoFuncsType) {
|
switch (vaoFuncsType) {
|
||||||
#ifndef QT_OPENGL_ES_2
|
#ifndef QT_OPENGL_ES_2
|
||||||
case Core_3_2:
|
case Core_3_2:
|
||||||
@ -220,6 +220,10 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_ASSERT(context);
|
||||||
|
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
|
||||||
|
context = 0;
|
||||||
|
|
||||||
vao = 0;
|
vao = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user