diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.cpp | 12 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 102b347..65014a6 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -54,7 +54,15 @@ Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() { - return connManager(); + static bool initialized = false; + + QNetworkConfigurationManagerPrivate *m = connManager(); + if (!initialized) { + initialized = true; + m->updateConfigurations(); + } + + return m; } /*! @@ -178,7 +186,7 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() QNetworkConfigurationManager::QNetworkConfigurationManager( QObject* parent ) : QObject(parent) { - QNetworkConfigurationManagerPrivate *priv = connManager(); + QNetworkConfigurationManagerPrivate *priv = qNetworkConfigurationManagerPrivate(); connect(priv, SIGNAL(configurationAdded(QNetworkConfiguration)), this, SIGNAL(configurationAdded(QNetworkConfiguration))); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index dd174bf..d388920 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -64,9 +64,6 @@ QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() { qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); qRegisterMetaType<QNetworkConfigurationPrivatePointer>("QNetworkConfigurationPrivatePointer"); - - moveToThread(QCoreApplicationPrivate::mainThread()); - updateConfigurations(); } QNetworkConfigurationManagerPrivate::~QNetworkConfigurationManagerPrivate() @@ -359,6 +356,13 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() if (sender()) return; + if (thread() != QCoreApplicationPrivate::mainThread()) { + if (thread() != QThread::currentThread()) + return; + + moveToThread(QCoreApplicationPrivate::mainThread()); + } + updating = false; #ifndef QT_NO_LIBRARY |