Don't quit application if we're not in exec

The documentation states that the function will not have any effect
before control enters the main event loop. Prior to 0c02f133f3
this was incidentally true due to QCoreApplication::exit just setting
quitNow to true and exiting all the event loops (which before exec
were none), and exec() setting quitNow to false explicitly. But
now that we plumb the quit down to the platform we can't rely
on this incidental behavior, and need to check explicitly.

Fixes: QTBUG-98088
Pick-to: 6.2
Change-Id: I54cece3630e39e4456abc3b372839c0b5c4c4713
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-11-08 16:57:24 +01:00
parent 7be143f438
commit 851ed6f0b1

View File

@ -2051,6 +2051,9 @@ void QCoreApplication::quit()
if (!self)
return;
if (!self->d_func()->in_exec)
return;
self->d_func()->quit();
}