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>
bb10
Fabian Kosmale 2021-06-25 15:33:45 +02:00
parent 71fea09e1a
commit b8e1782b67
1 changed files with 3 additions and 1 deletions

View File

@ -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);