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>
This commit is contained in:
parent
84acc4a4e9
commit
c3960e5997
@ -657,10 +657,11 @@ QMutex QWaylandWindow::mFrameSyncMutex;
|
|||||||
|
|
||||||
bool QWaylandWindow::waitForFrameSync(int timeout)
|
bool QWaylandWindow::waitForFrameSync(int timeout)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mFrameSyncMutex);
|
|
||||||
if (!mWaitingForFrameCallback)
|
if (!mWaitingForFrameCallback)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
QMutexLocker locker(&mFrameSyncMutex);
|
||||||
|
|
||||||
wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(mFrameCallback), mFrameQueue);
|
wl_proxy_set_queue(reinterpret_cast<wl_proxy *>(mFrameCallback), mFrameQueue);
|
||||||
mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout);
|
mDisplay->dispatchQueueWhile(mFrameQueue, [&]() { return mWaitingForFrameCallback; }, timeout);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user