diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-08-08 12:14:01 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-08-17 09:29:27 +0000 |
commit | 1ab4cf8def3f39fbe07bc3c84a2f229f18b28fc3 (patch) | |
tree | 7e9f707bc8ca13c036af40adcf79404b26298f51 | |
parent | 95c90197d3f9a59a41a01209ae71cf2ad95b82cc (diff) |
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 af7b60ade5c4be81cbc58eb18307c017d5594071.
Fixes: QTBUG-105308
Change-Id: I4805265f39e24eb1464897532be2025bc3c27728
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit a0c0b5b42335808c2222cbf72c1758e955731ed9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/client/qwaylandwindow.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 411aeff08..ef5070efe 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -909,7 +909,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; |