449b45ff34
The aboutToQuit signal is documented to be emitted "when the application is about to quit the main event loop", which is useful "if your application has to do some last-second cleanup", and is recommended over "putting it in your application's main() function because on some platforms the exec() call may not return". However, if we're on a platform where the exec call may not return, it will be because the event dispatcher's exec doesn't return, which means we'll never get out of the call to eventLoop.exec(QEventLoop::ApplicationExec) and into the execCleanup() code. In addition, on macOS, where we do currently return to main(), we do so by telling the platform to cancel the application termination, by returning NSTerminateCancel from applicationShouldTerminate, after running the quit logic of Qt via QWindowSystemInterface::handleApplicationTermination(). In the case of quitting applications due to system logout/shutdown, this cancellation brings up a dialog saying the Qt application interrupted the process, which luckily disappears again as soon as the application actually terminates via main(). Moving the emit of aboutToQuit() earlier in the flow, before we've cancelled the application termination, reduces the chance that long running code triggered from this signal will keep the dialog visible to the user. Task-number: QTBUG-102321 Change-Id: I362737e9563069fc02b1e9639e1251d655d13949 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> |
||
---|---|---|
.github/workflows | ||
bin | ||
cmake | ||
coin | ||
config.tests | ||
dist | ||
doc | ||
examples | ||
lib | ||
libexec | ||
LICENSES | ||
mkspecs | ||
qmake | ||
src | ||
tests | ||
util | ||
.cmake.conf | ||
.gitattributes | ||
.gitignore | ||
.lgtm.yml | ||
.tag | ||
CMakeLists.txt | ||
conanfile.py | ||
config_help.txt | ||
configure | ||
configure.bat | ||
configure.cmake | ||
dependencies.yaml | ||
qt_cmdline.cmake | ||
sync.profile |