From 8d8448a1f5a935f72ae5206df5ce95c651db1fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 29 Sep 2021 14:18:27 +0200 Subject: [PATCH] wasm: limit exec() workarounds to the main thread This fixes a bug where calling exec() on a secondary thread would make the thread exit. Task-number: QTBUG-94344 Pick-to: 6.2 Change-Id: I259c7ebbd53271609af88aca141d88c282cbcd34 Reviewed-by: Lorn Potter --- src/corelib/kernel/qeventdispatcher_wasm.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index 7632b2ca55..f5c2802aa6 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -206,10 +206,12 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags) qCDebug(lcEventDispatcher) << "QEventDispatcherWasm::processEvents flags" << flags << "pending events" << hasPendingEvents; - if (flags & QEventLoop::DialogExec) - handleDialogExec(); - else if (flags & QEventLoop::EventLoopExec) - handleEventLoopExec(); + if (isMainThreadEventDispatcher()) { + if (flags & QEventLoop::DialogExec) + handleDialogExec(); + else if (flags & QEventLoop::EventLoopExec) + handleEventLoopExec(); + } if (!(flags & QEventLoop::ExcludeUserInputEvents)) pollForNativeEvents();