From 5a5c20ad402af18f7bf56ad11edee2dfec3d7e63 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 30 Jun 2020 10:31:32 +0200 Subject: QFactoryLoader: Do not call unload() automatically QPluginLoader does not call unload() on the QLibraryPrivate without an explicit call to QPluginLoader::unload(). QFactoryLoader should behave the same. We want to avoid unload() if possible as we generally don't unload plugins and the resulting behavior varies between platforms. In particular, macOS does make the address space of libraries only the plugin links to inaccessible on close() even if RTLD_NODELETE is given. For code that actually wants to unload(), an explicit function to do so could be added. As QFactoryLoader is private API, there is no need to do that until such a case is found. Change-Id: I4e57259a9dcb4ceb60dfbfeda55abc0b995f436a Reviewed-by: Fabian Kosmale Reviewed-by: Volker Hilsheimer --- src/corelib/plugin/qfactoryloader.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 8b87baaff9..edadf7180a 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -178,11 +178,8 @@ Q_GLOBAL_STATIC(QRecursiveMutex, qt_factoryloader_mutex) QFactoryLoaderPrivate::~QFactoryLoaderPrivate() { - for (int i = 0; i < libraryList.count(); ++i) { - QLibraryPrivate *library = libraryList.at(i); - library->unload(); + for (QLibraryPrivate *library : qAsConst(libraryList)) library->release(); - } } void QFactoryLoader::update() -- cgit v1.2.3