summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qpluginloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/plugin/qpluginloader.cpp')
-rw-r--r--src/corelib/plugin/qpluginloader.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 62067c7ef7..4752f69ff3 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -154,6 +154,7 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
: QObject(parent), d(0), did_load(false)
{
setFileName(fileName);
+ setLoadHints(QLibrary::PreventUnloadHint);
}
/*!
@@ -348,7 +349,7 @@ static QString locatePlugin(const QString& fileName)
void QPluginLoader::setFileName(const QString &fileName)
{
#if defined(QT_SHARED)
- QLibrary::LoadHints lh;
+ QLibrary::LoadHints lh = QLibrary::PreventUnloadHint;
if (d) {
lh = d->loadHints();
d->release();
@@ -394,7 +395,7 @@ QString QPluginLoader::errorString() const
\brief Give the load() function some hints on how it should behave.
You can give hints on how the symbols in the plugin are
- resolved. By default, none of the hints are set.
+ resolved. By default since Qt 5.7, QLibrary::PreventUnloadHint is set.
See the documentation of QLibrary::loadHints for a complete
description of how this property works.