Commit 8b79fc4e authored by BogDan Vatra's avatar BogDan Vatra
Browse files

Make sure JNI_OnLoad is not called more than once

Since Android 5.0 Google introduce a nasty bug[1] which calls
JNI_OnLoad more than once.
Basically every time when a library is loaded JNI_OnLoad is
called if found, but it calls *again* JNI_OnLoad of its .so
dependencies!

[1] Workaround https://code.google.com/p/android/issues/detail?id=215069



Change-Id: I34728572bc279581b8c95c42c206ed104bfc09a5
Reviewed-by: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Showing with 5 additions and 0 deletions
......@@ -241,6 +241,11 @@ static bool registerNatives(JNIEnv *env)
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
{
static bool initialized = false;
if (initialized)
return JNI_VERSION_1_6;
initialized = true;
typedef union {
JNIEnv *nativeEnvironment;
void *venv;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment