summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-11-25 12:58:11 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-27 05:46:17 +0000
commit032105d4d27fdd5241a33268c31fc0244ddb50ea (patch)
tree875725583eeaae321fc7ed8f746f5e85d678b613 /src
parentd99fdf17842d914daa41124184c6531c92766cd0 (diff)
Inline the QPropertyBindingPrivatePtr destructor
In many cases, it only derefs and does nothing else. Inline the fast code path. Change-Id: Ib605c385c1683f7833f7189c84d6cf4eb5b0e59e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit eda4c29eb26dab32e22040bdda0b9b9109b1408b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qproperty.cpp5
-rw-r--r--src/corelib/kernel/qpropertyprivate.h7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index b96dcf2edd..8a0b21c8f5 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -47,10 +47,9 @@ QT_BEGIN_NAMESPACE
using namespace QtPrivate;
-QPropertyBindingPrivatePtr::~QPropertyBindingPrivatePtr()
+void QPropertyBindingPrivatePtr::destroyAndFreeMemory()
{
- if (d && (--d->ref == 0))
- QPropertyBindingPrivate::destroyAndFreeMemory(static_cast<QPropertyBindingPrivate *>(d));
+ QPropertyBindingPrivate::destroyAndFreeMemory(static_cast<QPropertyBindingPrivate *>(d));
}
void QPropertyBindingPrivatePtr::reset(QtPrivate::RefCounted *ptr) noexcept
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index d3ba9e38b1..a3fe2d208e 100644
--- a/src/corelib/kernel/qpropertyprivate.h
+++ b/src/corelib/kernel/qpropertyprivate.h
@@ -85,7 +85,12 @@ public:
T *take() noexcept { T *x = d; d = nullptr; return x; }
QPropertyBindingPrivatePtr() noexcept : d(nullptr) { }
- Q_CORE_EXPORT ~QPropertyBindingPrivatePtr();
+ ~QPropertyBindingPrivatePtr()
+ {
+ if (d && (--d->ref == 0))
+ destroyAndFreeMemory();
+ }
+ Q_CORE_EXPORT void destroyAndFreeMemory();
explicit QPropertyBindingPrivatePtr(T *data) noexcept : d(data) { if (d) d->addRef(); }
QPropertyBindingPrivatePtr(const QPropertyBindingPrivatePtr &o) noexcept