summaryrefslogtreecommitdiffstats
path: root/src/network/bearer
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@theqtcompany.com>2015-10-16 16:05:42 +0200
committerEdward Welbourne <edward.welbourne@theqtcompany.com>2016-01-12 09:55:29 +0000
commit6be65702f8922084c1b8da2ed04b2729340f0a6b (patch)
tree849b720c38ea734648ea6f39c06ffc0715ecfc68 /src/network/bearer
parent5fecbfb2c87d86fa1d78f42320a15ec0096a4a9e (diff)
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 <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/bearer')
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp8
1 files changed, 2 insertions, 6 deletions
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;