diff options
author | Christian Strømme <christian.stromme@digia.com> | 2013-10-29 17:40:56 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-30 14:50:02 +0100 |
commit | fb5036b7f12dd648340aaa7f90245afd353759e2 (patch) | |
tree | 1815835fc3cfc090be391c1b7714aafbcddbbea6 /src/corelib/kernel/qjni_p.h | |
parent | aa92cab34664143aa92ed6808ec925466de6f1d7 (diff) |
Android: Fix problem with leaking local refs.
In some cases we where not releasing the local references and since we
no longer disconnect from the VM on each call, the number of local refs.
would accumulating until it hit the hard-limit of 512.
Change-Id: I6826620e4cb61a37af26d276667489e876080076
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/corelib/kernel/qjni_p.h')
-rw-r--r-- | src/corelib/kernel/qjni_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index c5bbae26b9..ab98aec1bf 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -180,7 +180,9 @@ public: d = QSharedPointer<QJNIObjectData>(new QJNIObjectData()); QJNIEnvironmentPrivate env; d->m_jobject = env->NewGlobalRef(jobj); - d->m_jclass = static_cast<jclass>(env->NewGlobalRef(env->GetObjectClass(jobj))); + jclass objectClass = env->GetObjectClass(jobj); + d->m_jclass = static_cast<jclass>(env->NewGlobalRef(objectClass)); + env->DeleteLocalRef(objectClass); } return *this; |