Android: fix crash by passing the right Handle to dlsym()

dlsym() should be taking a Handle that is created by dlopen() instead of
pHnd.

* https://linux.die.net/man/3/dlsym

Fixes: QTBUG-84849
Pick-to: 5.15
Change-Id: Ic192736268ef9cbfdb86cf66d20082b14070ba00
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
Assam Boudjelthia 2020-10-28 13:04:53 +02:00
parent 7d875b4306
commit a95ddcf97b

View File

@ -243,10 +243,10 @@ bool QLibraryPrivate::load_sys()
}
if (hnd) {
using JniOnLoadPtr = jint (*)(JavaVM *vm, void *reserved);
JniOnLoadPtr jniOnLoad = reinterpret_cast<JniOnLoadPtr>(dlsym(pHnd, "JNI_OnLoad"));
JniOnLoadPtr jniOnLoad = reinterpret_cast<JniOnLoadPtr>(dlsym(hnd, "JNI_OnLoad"));
if (jniOnLoad && jniOnLoad(QtAndroidPrivate::javaVM(), nullptr) == JNI_ERR) {
dlclose(hnd);
pHnd = nullptr;
hnd = nullptr;
}
}
#endif