summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/plugin/qlibrary.cpp2
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index 9babfa4d912..ff041167059 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -1096,8 +1096,6 @@ QString QLibrary::errorString() const
to the library \c shr_64.o in the archive file named \c libGL.a. This
is only supported on the AIX platform.
- Setting PreventUnloadHint will only apply on Unix platforms.
-
The interpretation of the load hints is platform dependent, and if
you use it you are probably making some assumptions on which platform
you are compiling for, so use them only if you understand the consequences
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index deec54db0a2..95e5afa8378 100644
--- a/src/corelib/plugin/qlibrary_win.cpp
+++ b/src/corelib/plugin/qlibrary_win.cpp
@@ -148,6 +148,16 @@ bool QLibraryPrivate::load_sys()
else
qualifiedFileName = dir.filePath(moduleFileName);
#endif // !Q_OS_WINRT
+
+ if (loadHints() & QLibrary::PreventUnloadHint) {
+ // prevent the unloading of this component
+ HMODULE hmod;
+ bool ok = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN |
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ reinterpret_cast<const wchar_t *>(pHnd),
+ &hmod);
+ Q_ASSERT(!ok || hmod == pHnd);
+ }
}
return (pHnd != 0);
}