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>bb10
parent
6813a21c52
commit
9f983eac9f
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue