QLibrary/Android: Correct improper merging

I had originally developed ae6f73e856 in
5.13, where this code for Android didn't exist. I didn't notice the use
of pHnd there when I merged up for the push.

Change-Id: Ibdc95e9af7bd456a94ecfffd160208dfaa596d95
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Thiago Macieira 2020-04-02 12:02:55 -03:00
parent 274e973dbe
commit 9834536cfa

View File

@ -235,15 +235,15 @@ bool QLibraryPrivate::load_sys()
hnd = dlopen(QFile::encodeName(attempt), dlFlags);
#ifdef Q_OS_ANDROID
if (!pHnd) {
if (!hnd) {
auto attemptFromBundle = attempt;
pHnd = dlopen(QFile::encodeName(attemptFromBundle.replace(QLatin1Char('/'), QLatin1Char('_'))), dlFlags);
hnd = dlopen(QFile::encodeName(attemptFromBundle.replace(QLatin1Char('/'), QLatin1Char('_'))), dlFlags);
}
if (pHnd) {
if (hnd) {
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);
dlclose(hnd);
pHnd = nullptr;
}
}