summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/plugin/qlibrary_win.cpp')
-rw-r--r--src/corelib/plugin/qlibrary_win.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp
index deec54db0a..95e5afa837 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);
}