From 486dcfc0102abd02e9c61ebe81b5d961cc2406a6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 28 Aug 2023 17:10:27 +0300 Subject: [PATCH] Client: Fix QT_WAYLAND_RESIZE_AFTER_SWAP mResizeLock can be locked several times by the same thread in the following scenario QWaylandWindow::setGeometry() at qwaylandwindow.cpp:429:43 QWaylandEglWindow::setGeometry() at qwaylandeglwindow.cpp:58:32 QWaylandWindow::resizeFromApplyConfigure() at qwaylandwindow.cpp:517:16 QWaylandXdgSurface::Toplevel::applyConfigure() at qwaylandxdgshell.cpp:91:57 QWaylandXdgSurface::applyConfigure() at qwaylandxdgshell.cpp:381:35 QWaylandWindow::doApplyConfigure() at qwaylandwindow.cpp:628:38 QWaylandWindow::applyConfigure() at qwaylandwindow.cpp:671:25 Since mResizeLock is not a recursive mutex, the main thread just blocks in QWaylandWindow::setGeometry(). To prevent that, this patch changes the type of mResizeLock from QMutex to QRecursiveMutex. Change-Id: I362f4909bfdfc2d91b7cf902f27d35c742ac5091 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/wayland/qwaylandwindow_p.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h index fbf629066e3..445a05b7f43 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow_p.h +++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h @@ -187,7 +187,6 @@ public: QWaylandWindow *transientParent() const; - QMutex *resizeMutex() { return &mResizeLock; } void doApplyConfigure(); void setCanResize(bool canResize); @@ -295,7 +294,7 @@ protected: // True when we have called deliverRequestUpdate, but the client has not yet attached a new buffer bool mWaitingForUpdate = false; - QMutex mResizeLock; + QRecursiveMutex mResizeLock; bool mWaitingToApplyConfigure = false; bool mCanResize = true; bool mResizeDirty = false;