When the user manually quits an application by swiping it up in the "Task Manager" the only signal to hook in is "QGuiApplication::aboutToQuit()".
Unfortunately, when this signal is called, the whole Event system for the main thread has already stopped working without any possibility to reactivate.
- Calling QEventLoop::exec() on a local event loop would simply return immediately with a return code != 0
- Also QGuiApplication::processEvents() would have no effect in this state!
This is a huge pitfall since on , windows and macOS local event loops work fine in this scenario.
Processing Local event loops in exit-cleanup code is an essential feature. Eg: For handling cleanup of background threads which invoke functions in the main thread via "BlockingQueuedConnection".
How to reproduce:
- Create a qml project
- replace main.cpp with the one attached
- run via QtCreator in debug mode on iOS
- quit the application on the iOS device by swiping it up in the task manager
- "qDebug() << "Exiting localEventLoop"; " will never be called