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 <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Vlad Zahorodnii 2023-08-28 17:10:27 +03:00
parent b59d243ce2
commit 486dcfc010

View File

@ -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;