From b8e1782b670a10fe551669bdce654025acba225f Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 25 Jun 2021 15:33:45 +0200 Subject: 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 --- src/corelib/kernel/qproperty.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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(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); -- cgit v1.2.3