diff options
author | Christian Strømme <christian.stromme@theqtcompany.com> | 2015-02-03 17:43:02 +0100 |
---|---|---|
committer | Christian Stromme <christian.stromme@theqtcompany.com> | 2015-02-26 13:02:27 +0000 |
commit | c8d64cbcc6728e8862cc16bb1d007349fd7012b4 (patch) | |
tree | d7d665c1b7b0c70873ff594494985a092a88b37d /src/corelib/kernel/qjni_p.h | |
parent | cb27388eb06335ce50bf599e5fc15b2d2c9a543a (diff) |
Android: Add scoped local ref. handler.
Adds an internal class for handling local jni references. When calling
raw jni functions the returned object is usually a local reference, to
avoid overflowing the local reference table we need to free any local
ref. as soon as we're done with them. The class QJNIScopedLocalRef,
a QScopedPointer, makes this process a lot easier.
Change-Id: I093e5671f0dcd254d5c2c7985c8c0f625d5592a4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/corelib/kernel/qjni_p.h')
-rw-r--r-- | src/corelib/kernel/qjni_p.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/kernel/qjni_p.h b/src/corelib/kernel/qjni_p.h index e79caed5b8..ae9c7c3a7e 100644 --- a/src/corelib/kernel/qjni_p.h +++ b/src/corelib/kernel/qjni_p.h @@ -51,6 +51,14 @@ QT_BEGIN_NAMESPACE +struct Q_CORE_EXPORT QJNILocalRefDeleter +{ + static void cleanup(jobject obj); +}; + +// To simplify this we only define it for jobjects. +typedef QScopedPointer<_jobject, QJNILocalRefDeleter> QJNIScopedLocalRef; + class Q_CORE_EXPORT QJNIEnvironmentPrivate { public: |