Fixed deadlock situation in QtOpenGL's texture management.
QGLTextureCache::remove(qint64 key) locks the QGLContextGroupList mutex before removing a texture. Removing the texture might cause the QGLShareContextScope construct to be invoked, which calls QGLContext::currentContext(), which will wrap a current QOpenGLContext in a newly created QGLContext. That also triggers the creation of a QGLContextGroup object, which will register itself with the QGLContextGroupList, an operation that again will lock the QGLContextGroupList mutex. To prevent this from deadlocking we make the mutex recursive. The whole QGLShareContextScope approach is really broken and should be replaced, but for now it's what we have in QtOpenGL (QtGui has the replacement QOpenGLSharedResource). Change-Id: Id1ff69035af3f31b690892c03f74748d052a278b Reviewed-by: Zeno Albisser <zeno.albisser@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
parent
60bd2156f8
commit
0ce317826f
@ -1477,6 +1477,11 @@ bool operator!=(const QGLFormat& a, const QGLFormat& b)
|
||||
}
|
||||
|
||||
struct QGLContextGroupList {
|
||||
QGLContextGroupList()
|
||||
: m_mutex(QMutex::Recursive)
|
||||
{
|
||||
}
|
||||
|
||||
void append(QGLContextGroup *group) {
|
||||
QMutexLocker locker(&m_mutex);
|
||||
m_list.append(group);
|
||||
|
Loading…
Reference in New Issue
Block a user