QSettings: fix a misleading comment
Destructors in C++ are implicitly noexcept, so the try-catch around QSettingsPrivate::flush() is not to prevent throwing from a dtor (anymore), but to prevent a throw statement inside flush() from taking down the whole application. We don't need to care about abi::__forced_unwind here, since we couldn't re-throw it even if we wanted to (throw in noexcept function is direct std::terminate(); at least by not re-throwing, the user will get a nice complaint message from the runtime). Pick-to: 6.3 Change-Id: I3b24a4be9aeb74637a58725540990b535d005bdd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0c1f9ab36b
commit
18eaf72991
@ -2716,10 +2716,11 @@ QSettings::~QSettings()
|
||||
{
|
||||
Q_D(QSettings);
|
||||
if (d->pendingChanges) {
|
||||
// Don't cause a failing flush() to std::terminate() the whole
|
||||
// application - dtors are implicitly noexcept!
|
||||
QT_TRY {
|
||||
d->flush();
|
||||
} QT_CATCH(...) {
|
||||
; // ok. then don't flush but at least don't throw in the destructor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user