summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Tumakaev <p.tumakaev@lgepartner.com>2019-07-31 13:26:51 +0300
committerPavel Tumakaev <p.tumakaev@lgepartner.com>2019-09-04 14:38:29 +0300
commit33d2062f8ac9419ec1c6504be47fe48119e605bb (patch)
tree1119566b5658e59e1d4e15b13741c98eefafd125 /src
parent2e9c90aaefdfe5f1e9b90159c5e6981230627055 (diff)
downloadqtwayland-33d2062f8ac9419ec1c6504be47fe48119e605bb.tar.gz
Fix deadlock in QWaylandWindow::waitForFrameSync
Calling the QOpenGLContext::swapBuffers from QGuiApplicationPrivate::processExposeEvent in some cases leads to recursive calls of QWaylandWindow::waitForFrameSync. Since the mWaitingForFrameCallback check in WaylandWindow::waitForFrameSync is performed after the mutex is locked, the QMutexLocker tries to lock the mFrameSyncMutex mutex in every recursive call, that leads to a deadlock. This patch moves the performing of the mWaitingForFrameCallback check before locking the mutex. Change-Id: Ia2d834b7dd03fcd91bbe29a3a897b4db2d155527 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/client/qwaylandwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index abc54f58..95358232 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -657,10 +657,11 @@ QMutex QWaylandWindow::mFrameSyncMutex;
bool QWaylandWindow::waitForFrameSync(int timeout)
{
- QMutexLocker locker(&mFrameSyncMutex);
if (!mWaitingForFrameCallback)
return true;
+ QMutexLocker locker(&mFrameSyncMutex);
+
wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(mFrameCallback), mFrameQueue);
mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout);