diff --git a/src/corelib/kernel/qeventdispatcher_wasm.cpp b/src/corelib/kernel/qeventdispatcher_wasm.cpp index e09d0c4242e..db2a3bd1217 100644 --- a/src/corelib/kernel/qeventdispatcher_wasm.cpp +++ b/src/corelib/kernel/qeventdispatcher_wasm.cpp @@ -225,6 +225,11 @@ bool QEventDispatcherWasm::processEvents(QEventLoop::ProcessEventsFlags flags) processPostedEvents(); + // 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;