From 6f8b1bd725633d458653c06dfc782a5fc5cd24df Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 8 Aug 2022 12:14:01 +0200 Subject: [PATCH] Avoid calling requestUpdate from wrong thread In certain circumstances, we can get to createDecoration() from the render thread (from QWaylandGLContext::makeCurrent) Calling requestUpdate() from this secondary thread would cause an assert, so we queue the call on the appropriate thread instead. This amends 1a2e499e0e05a03460f4335d5266be485f97d3fa. Pick-to: 5.15 6.2 6.3 6.3.2 6.4 Fixes: QTBUG-105308 Change-Id: I4805265f39e24eb1464897532be2025bc3c27728 Reviewed-by: Inho Lee --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 27572185df8..53ebbe75c8c 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -932,7 +932,11 @@ bool QWaylandWindow::createDecoration() // size and are not redrawn, leaving the new buffer empty. As a simple // work-around, we trigger a full extra update whenever the client-side // window decorations are toggled while the window is showing. - window()->requestUpdate(); + // Note: createDecoration() is sometimes called from the render thread + // of Qt Quick. This is essentially wrong and could potentially cause problems, + // but until the underlying issue has been fixed, we have to use invokeMethod() + // here to avoid asserts. + QMetaObject::invokeMethod(window(), &QWindow::requestUpdate); } return mWindowDecoration;