summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2016-07-20 15:47:58 +0300
committerBogDan Vatra <bogdan@kdab.com>2016-07-20 13:04:02 +0000
commit6f28963c50261fffdabd48be0b0dfe20480277bb (patch)
tree3c2fd81ebc025755b97c2db4cca7af4906bc2771 /src
parent17674ddc637a059c3052953c1ec8a80a7d078293 (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: I81b4a94beedaad299267ac6deab2f9c3a1693a62 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/android/src/qandroidmediaserviceplugin.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/android/src/qandroidmediaserviceplugin.cpp b/src/plugins/android/src/qandroidmediaserviceplugin.cpp
index bf89badb3..91381b76d 100644
--- a/src/plugins/android/src/qandroidmediaserviceplugin.cpp
+++ b/src/plugins/android/src/qandroidmediaserviceplugin.cpp
@@ -145,6 +145,11 @@ QT_END_NAMESPACE
#ifndef Q_OS_ANDROID_NO_SDK
Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
{
+ static bool initialized = false;
+ if (initialized)
+ return JNI_VERSION_1_6;
+ initialized = true;
+
QT_USE_NAMESPACE
typedef union {
JNIEnv *nativeEnvironment;