summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-02-26 12:33:49 +0100
committerThiago Macieira <thiago.macieira@intel.com>2024-04-03 13:15:43 -0800
commit60417a265a152aaa21081d8b4f2ad28c9730ca0f (patch)
tree51670220435c1ca587b3e348ba7789da8c86fac2 /src/corelib/plugin/qlibrary_unix.cpp
parent9828ddadfb67818467b130aab081442cc2342a60 (diff)
QLibrary: fake RLTD_NODELETE by not calling dlclose()
On systems without the RTLD_NODELETE flag, simply don't call dlclose() and leak the handle. Amends ef5ab6e00664caf0af23b21593f809d718c9dfc7. Pick-to: 6.7 Change-Id: I01ec3c774d9943adb903fffd17b76673562daa8a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/plugin/qlibrary_unix.cpp')
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index f4eee7fb94..4bbfd89cd6 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -257,8 +257,12 @@ bool QLibraryPrivate::load_sys()
bool QLibraryPrivate::unload_sys()
{
-#if !defined(Q_OS_VXWORKS) // Unloading on VxWorks causes crashes in QtDeclarative autotests
- if (dlclose(pHnd.loadAcquire())) {
+ bool doTryUnload = true;
+#ifndef RTLD_NODELETE
+ if (loadHints() & QLibrary::PreventUnloadHint)
+ doTryUnload = false;
+#endif
+ if (doTryUnload && dlclose(pHnd.loadAcquire())) {
const char *error = dlerror();
#if defined (Q_OS_QNX)
// Workaround until fixed in QNX; fixes crash in
@@ -271,7 +275,6 @@ bool QLibraryPrivate::unload_sys()
return false;
}
errorString.clear();
-#endif
return true;
}