summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-07-20 15:44:45 +0300
committerBogDan Vatra <bogdan@kdab.com>2016-07-20 13:03:49 +0000
commit20c00be872220f547211b87a2d3d34e12bd0f3d8 (patch)
tree0eab842ba0859db2e5b23ae07e2473415130687c
parent3d5bfc3e0c938cdb7d72d7cead92578a82fefdc5 (diff)
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: I87b50b67d7c63a32b3fae067a78780a17b058acb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/webview/qwebview_android.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/webview/qwebview_android.cpp b/src/webview/qwebview_android.cpp
index 54f6a3d..1783deb 100644
--- a/src/webview/qwebview_android.cpp
+++ b/src/webview/qwebview_android.cpp
@@ -401,6 +401,11 @@ static void c_onReceivedError(JNIEnv *env,
JNIEXPORT jint 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;