diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-06-25 15:33:45 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-08-04 19:31:52 +0200 |
commit | b8e1782b670a10fe551669bdce654025acba225f (patch) | |
tree | 207b0f4f3c56a5ec4ef728f8e14017ebb7af1cc2 /src | |
parent | 71fea09e1a8d1fc5d9cca7c504f45b77725c0e21 (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.
Pick-to: 6.2
Change-Id: Ic20142e4c4e09752b5c41b959f66080e6885e6c3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-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 db202ad725..8fdd261e08 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); |