diff options
author | BogDan Vatra <bogdan@kde.org> | 2019-09-17 09:54:28 +0300 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2019-09-22 14:25:11 +0200 |
commit | ec0e9f29dfd0b45edf5fd33e8ccf763e604612d7 (patch) | |
tree | 7d65b5af4bf0291c67dfbd709c09c6563ea762cf /src/corelib/plugin/qlibrary_unix.cpp | |
parent | f155c40fdc0b7bbc12804ba77c00e217ba6c2bb3 (diff) |
Android: Fix loading of plugins
In 5bb178c479a247720fbc3fbb7f06a32b725193ac, the Android platform plugin was moved from
platforms/android to platforms/. The unforeseen consequence of this was that the plugin
loader for plugins/platforms would now find it, whereas before it would be ignored. It
would therefore be detected as the appropriate plugin, but since it was intended to be
loaded as a static plugin, loading it dynamically would fail.
Instead of fixing the static plugin loading, we remove this hack.
Fixes: QTBUG-78440
Change-Id: Idcb6c075fdebaf67644f32a59d7aaf0d1c0bbe20
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/corelib/plugin/qlibrary_unix.cpp')
-rw-r--r-- | src/corelib/plugin/qlibrary_unix.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 44d5513163..f0de1010d7 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -236,6 +236,14 @@ bool QLibraryPrivate::load_sys() auto attemptFromBundle = attempt; pHnd = dlopen(QFile::encodeName(attemptFromBundle.replace(QLatin1Char('/'), QLatin1Char('_'))), dlFlags); } + if (pHnd) { + using JniOnLoadPtr = jint (*)(JavaVM *vm, void *reserved); + JniOnLoadPtr jniOnLoad = reinterpret_cast<JniOnLoadPtr>(dlsym(pHnd, "JNI_OnLoad")); + if (jniOnLoad && jniOnLoad(QtAndroidPrivate::javaVM(), nullptr) == JNI_ERR) { + dlclose(pHnd); + pHnd = nullptr; + } + } #endif if (!pHnd && fileName.startsWith(QLatin1Char('/')) && QFile::exists(attempt)) { |