diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2012-12-13 11:58:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-14 08:56:02 +0100 |
commit | 0ce317826f4fbef0e9297856322e1883e112a362 (patch) | |
tree | 9780adf73745e6d69062cf08f15c805a799e6023 /src/opengl/qgl.cpp | |
parent | 60bd2156f81b154a47c95989b0266944fd2f2859 (diff) |
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>
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 69f4871c6b..9489762516 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -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); |