diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-02-22 23:30:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-24 17:05:01 +0100 |
commit | 9f983eac9f926b4ea3ee4ec860f58dc33a5b7fe7 (patch) | |
tree | de904dbf91f2a9526fb268d22b7a04e1b78ce8dc /src/corelib/kernel | |
parent | 6813a21c522631e5388b2cbf3f8e4e273b0d27ce (diff) |
QJNI: optimize QSharedPointer creation
Instead of QSharedPointer<T>(new T), use QSharedPointer<T>::create(), since the latter
co-locates the refcount and the T instance in a single memory allocation, unlike the
first form, which uses separate memory allocations.
Change-Id: I5095ac43448aad9a7e3ec07ed4dcdca869bcd9e8
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qjni_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index b1f0011b94..83dd3a00af 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -177,7 +177,7 @@ public: { jobject jobj = static_cast<jobject>(o); if (!isSameObject(jobj)) { - d = QSharedPointer<QJNIObjectData>(new QJNIObjectData()); + d = QSharedPointer<QJNIObjectData>::create(); if (jobj) { QJNIEnvironmentPrivate env; d->m_jobject = env->NewGlobalRef(jobj); |