diff options
author | Even Oscar Andersen <even.oscar.andersen@qt.io> | 2024-05-06 09:07:28 +0200 |
---|---|---|
committer | Even Oscar Andersen <even.oscar.andersen@qt.io> | 2024-05-08 06:47:16 +0000 |
commit | 1530c475e98d2dfdc2f6fc55ecc4d8707544191c (patch) | |
tree | e395a54bd0edd3c1146c9a5f5eafe8a95b3c404e | |
parent | 1a4470a8eff39b96c13a5f9826b0366b5418c738 (diff) |
If the QWindow::handle() has not been created yet we will add
a zero page pointer to the allwindows list.
One possible symptom is that emscripten::val complains
in context2d() that it is accessed by the wrong thread.
what happens is that the this pointer points to the first
page.
Seen in the documentviewer example
Change-Id: I2b08176ebdd7c35d5105194f7fd9f4f6d45b77e5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
-rw-r--r-- | src/plugins/platforms/wasm/qwasmscreen.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp index ddf8140c48..0490b2bfe0 100644 --- a/src/plugins/platforms/wasm/qwasmscreen.cpp +++ b/src/plugins/platforms/wasm/qwasmscreen.cpp @@ -361,10 +361,14 @@ QList<QWasmWindow *> QWasmScreen::allWindows() { QList<QWasmWindow *> windows; for (auto *child : childStack()) { - QWindowList list = child->window()->findChildren<QWindow *>(Qt::FindChildrenRecursively); - std::transform( - list.begin(), list.end(), std::back_inserter(windows), - [](const QWindow *window) { return static_cast<QWasmWindow *>(window->handle()); }); + const QWindowList list = child->window()->findChildren<QWindow *>(Qt::FindChildrenRecursively); + for (auto child : list) { + auto handle = child->handle(); + if (handle) { + auto wnd = static_cast<QWasmWindow *>(handle); + windows.push_back(wnd); + } + } windows.push_back(child); } return windows; |