summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qpropertyprivate.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-11-25 12:58:11 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-11-30 23:02:28 +0000
commitf538ce920ec94e07124ebc77f01a00706aa8f4ae (patch)
tree07b04fb10af89060a89eb8e990ce346f46094bf6 /src/corelib/kernel/qpropertyprivate.h
parent1181286d43bd3f0d4712307c60563d75d4615de3 (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: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertyprivate.h')
-rw-r--r--src/corelib/kernel/qpropertyprivate.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index 91d9e56d2f..10bf4ca828 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