diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index 482e617ba18..dac02ad24dc 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -221,6 +221,11 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags) QCoreApplication::sendPostedEvents(); processWindowSystemEvents(flags); + // The processPostedEvents() call above may process an event which deletes the + // application object and the event dispatcher; stop event processing in that case. + if (!isValidEventDispatcherPointer(this)) + return false; + if (m_interrupted) { m_interrupted = false; return false;