diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-25 15:45:28 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-09-29 20:32:32 +0200 |
commit | 6b4e0c5803b4b8b4396791ba436d9692195993d6 (patch) | |
tree | a822ce5bfcd8c44f83f12dead974cc4f4e1d153f /src/corelib/kernel/qproperty_p.h | |
parent | 7a41b928d415b69635abeff13a3a6d205386652f (diff) |
QProperty: fix QBindingStoragePrivate::reallocate related code
In the internal hash map implementation, we have to ensure that the
index is in the interval [0, size - 1].
Moreover, in setBinding we have to refetch the binding storage in case a
reallocation happened.
Change-Id: I11c6264f16537699c8908b647e2355a39ce87648
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qproperty_p.h')
-rw-r--r-- | src/corelib/kernel/qproperty_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h index 999760ec86..614756a670 100644 --- a/src/corelib/kernel/qproperty_p.h +++ b/src/corelib/kernel/qproperty_p.h @@ -397,6 +397,9 @@ public: { QtPrivate::QPropertyBindingData *bd = qGetBindingStorage(owner())->bindingData(this, true); QUntypedPropertyBinding oldBinding(bd->setBinding(newBinding, this, nullptr, bindingWrapper)); + // refetch the binding data, as the eager evaluation in setBinding() above could cause a reallocation + // in the binding storage + bd = qGetBindingStorage(owner())->bindingData(this); notify(bd); return static_cast<QPropertyBinding<T> &>(oldBinding); } |