diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 7d9bfa3d77e..b2059229d20 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -242,21 +242,12 @@ struct CompatPropertySafePoint struct CurrentCompatPropertyThief { Q_DISABLE_COPY_MOVE(CurrentCompatPropertyThief) + QScopedValueRollback m_guard; public: CurrentCompatPropertyThief(QBindingStatus *status) - : status(&status->currentCompatProperty) - , stolen(std::exchange(status->currentCompatProperty, nullptr)) + : m_guard(status->currentCompatProperty, nullptr) { } - - ~CurrentCompatPropertyThief() - { - *status = stolen; - } - -private: - CompatPropertySafePoint **status = nullptr; - CompatPropertySafePoint *stolen = nullptr; }; }