Core: Don't sneakily set auto apply

When a container is set to !autoApply during apply() its already too late
since the aspects will have already applied themselves and therefor the
following "isDirty()" check will return false. This leads to really aweful to
debug issues where the first time you change an aspect its not saved but
on the second try it might be saved if its changed again in the meanwhile.

Its better to fail here and never save, I would even suggest a Q_ASSERT
and crash but thats against our styleguide.

Change-Id: I934f5d7e95615b2c6343a0d601fbcfd0a65b274d
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-09-17 13:10:56 +02:00
parent cff5d55651
commit 932a05c3bb

View File

@@ -263,7 +263,7 @@ void IOptionsPage::apply()
if (!container->aspects().isEmpty()) {
BaseAspect *aspect = container->aspects().first();
QTC_ASSERT(aspect, return);
QTC_ASSERT(!aspect->isAutoApply(), container->setAutoApply(false));
QTC_ASSERT(!aspect->isAutoApply(), return);
}
if (container->isDirty()) {
container->apply();