From 6be65702f8922084c1b8da2ed04b2729340f0a6b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 16 Oct 2015 16:05:42 +0200 Subject: Minimal fix for network-manager problem on plugin unload. This fixes the problem as long as we have C++ 11's semantics for in-function statics. The Q_GLOBAL_STATIC_WITH_ARGS() is a non-trivial wrapper whose destructor gets unloaded with the plugin, leading to a crash-on-exit if the global it wraps outlives the plugin. The plain (in-function) static manages to avoid this by avoiding the wrapper. As the static was only needed in one place, this proves a sufficient solution to the plugin-unload problem *in this case*. Task-number: QTBUG-45891 Change-Id: I599fbee0b55ece4dceb4bf7202db374b507f5388 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- src/network/bearer/qnetworkconfigmanager_p.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 9c761f9479..4e74595909 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -51,11 +51,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_LIBRARY -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) -#endif - QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() : QObject(), pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true) { @@ -382,7 +377,8 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() bool envOK = false; const int skipGeneric = qEnvironmentVariableIntValue("QT_EXCLUDE_GENERIC_BEARER", &envOK); QBearerEngine *generic = 0; - QFactoryLoader *l = loader(); + static QFactoryLoader loader(QBearerEngineFactoryInterface_iid, QLatin1String("/bearer")); + QFactoryLoader *l = &loader; const PluginKeyMap keyMap = l->keyMap(); const PluginKeyMapConstIterator cend = keyMap.constEnd(); QStringList addedEngines; -- cgit v1.2.3