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 <inho.lee@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-08-08 12:14:01 +02:00
parent 4132a63f14
commit 6f8b1bd725

View File

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