Paste P478

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Oct 11 2019, 12:35 PM.
commit 33d2062f8ac9419ec1c6504be47fe48119e605bb
Author: Pavel Tumakaev <p.tumakaev@lgepartner.com>
Date: Wed Jul 31 13:26:51 2019 +0300
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>
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);
davidedmundson edited the content of this paste. (Show Details)Oct 11 2019, 12:35 PM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.