Fix problem with queued signals on main thread

Queued signals from main thread were not handled if enqueued on
a different thread. This is because qt_jspi_can_resume_js was
called on a thread (worker), where the Module object does not have
the property used for determining whether JSPI is suspended.

Change-Id: Icbc4dbfcf46c1091eb71b23c7de50760c8a339ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
bb10
Mikolaj Boc 2023-08-18 16:35:10 +02:00 committed by Piotr Wierciński
parent 262031d364
commit 1c8b4ac67b
1 changed files with 9 additions and 3 deletions

View File

@ -531,9 +531,15 @@ bool QEventDispatcherWasm::wakeEventDispatcherThread()
#endif
Q_ASSERT(isMainThreadEventDispatcher());
if (useJspi()) {
if (!qt_jspi_can_resume_js())
return false;
runOnMainThread([]() { qt_jspi_resume_js(); });
#if QT_CONFIG(thread)
return qstdweb::runTaskOnMainThread<bool>(
[]() { return qt_jspi_can_resume_js() && qt_jspi_resume_js(); }, &g_proxyingQueue);
#else
return qstdweb::runTaskOnMainThread<bool>(
[]() { return qt_jspi_can_resume_js() && qt_jspi_resume_js(); });
#endif
} else {
if (!g_is_asyncify_suspended)
return false;