diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-06-25 15:33:45 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-04 23:10:19 +0000 |
commit | a490ccede756235887ef23baf18063f87bd4ef4c (patch) | |
tree | df2b2c32ae92eb58be75f8b09f80ab0fd51399f9 /src/corelib/kernel/qproperty.cpp | |
parent | 4ee4768caf2a5dd691ef961ac330baae3035e542 (diff) |
Avoid superfluous QBindingStoragePrivate::get call
If we have no currentBinding, then registerWithCurrentlyEvaluatingBinding
will not do anything. Thus we can completely avoid fetching the storage.
Change-Id: Ic20142e4c4e09752b5c41b959f66080e6885e6c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit b8e1782b670a10fe551669bdce654025acba225f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel/qproperty.cpp')
-rw-r--r-- | src/corelib/kernel/qproperty.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp index 5e9dfb0e2d..09c74f1ed2 100644 --- a/src/corelib/kernel/qproperty.cpp +++ b/src/corelib/kernel/qproperty.cpp @@ -2202,7 +2202,9 @@ void QBindingStorage::registerDependency_helper(const QUntypedPropertyData *data else currentBinding = QT_PREPEND_NAMESPACE(bindingStatus).currentlyEvaluatingBinding; QUntypedPropertyData *dd = const_cast<QUntypedPropertyData *>(data); - auto storage = QBindingStoragePrivate(d).get(dd, /*create=*/ currentBinding != nullptr); + if (!currentBinding) + return; + auto storage = QBindingStoragePrivate(d).get(dd, true); if (!storage) return; storage->registerWithCurrentlyEvaluatingBinding(currentBinding); |