From a95ddcf97bcb3c5a6727fcaf6b3b74c05051ac4f Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Wed, 28 Oct 2020 13:04:53 +0200 Subject: [PATCH] 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 --- src/corelib/plugin/qlibrary_unix.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 46139b760e..95aeee8732 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -243,10 +243,10 @@ bool QLibraryPrivate::load_sys() } if (hnd) { using JniOnLoadPtr = jint (*)(JavaVM *vm, void *reserved); - JniOnLoadPtr jniOnLoad = reinterpret_cast(dlsym(pHnd, "JNI_OnLoad")); + JniOnLoadPtr jniOnLoad = reinterpret_cast(dlsym(hnd, "JNI_OnLoad")); if (jniOnLoad && jniOnLoad(QtAndroidPrivate::javaVM(), nullptr) == JNI_ERR) { dlclose(hnd); - pHnd = nullptr; + hnd = nullptr; } } #endif