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 <lorn.potter@gmail.com>
bb10
Morten Johan Sørvig 2021-09-29 14:18:27 +02:00
parent 8d6e825ddf
commit 8d8448a1f5
1 changed files with 6 additions and 4 deletions

View File

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