diff -Naur qtbase-opensource-src-5.6.1.orig/src/corelib/plugin/qfactoryloader.cpp qtbase-opensource-src-5.6.1/src/corelib/plugin/qfactoryloader.cpp --- qtbase-opensource-src-5.6.1.orig/src/corelib/plugin/qfactoryloader.cpp 2016-10-31 16:51:05.058042123 +0100 +++ qtbase-opensource-src-5.6.1/src/corelib/plugin/qfactoryloader.cpp 2016-10-31 16:52:50.488044482 +0100 @@ -208,10 +208,12 @@ ++keyUsageCount; } } - if (keyUsageCount || keys.isEmpty()) + if (keyUsageCount || keys.isEmpty()) { + library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload d->libraryList += library; - else + } else { library->release(); + } } } #else diff -Naur qtbase-opensource-src-5.6.1.orig/src/corelib/plugin/qpluginloader.cpp qtbase-opensource-src-5.6.1/src/corelib/plugin/qpluginloader.cpp --- qtbase-opensource-src-5.6.1.orig/src/corelib/plugin/qpluginloader.cpp 2016-10-31 16:51:05.057042123 +0100 +++ qtbase-opensource-src-5.6.1/src/corelib/plugin/qpluginloader.cpp 2016-10-31 16:54:49.756047150 +0100 @@ -148,6 +148,7 @@ : QObject(parent), d(0), did_load(false) { setFileName(fileName); + setLoadHints(QLibrary::PreventUnloadHint); } /*! @@ -342,7 +343,7 @@ 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(); @@ -391,7 +392,7 @@ \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.