From 7388fcb83592a90aace054314e0c3e7e7a94fdae Mon Sep 17 00:00:00 2001 From: Cristiano di Flora Date: Tue, 22 Feb 2011 05:27:51 +0200 Subject: Fix QNetworkConfigurationManager crash due to null private pointer. Reviewed-by: Aaron McCarthy Task-Number: QTBUG-17305 --- src/network/bearer/qnetworkconfigmanager.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 9927f29..a3b278c 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -57,16 +57,17 @@ QT_BEGIN_NAMESPACE { \ delete this_##NAME.pointer; \ this_##NAME.pointer = 0; \ - this_##NAME.destroyed = true; \ } \ static TYPE *NAME() \ { \ - if (!this_##NAME.pointer && !this_##NAME.destroyed) { \ + if (!this_##NAME.pointer) { \ TYPE *x = new TYPE; \ if (!this_##NAME.pointer.testAndSetOrdered(0, x)) \ delete x; \ - else \ + else { \ qAddPostRoutine(NAME##_cleanup); \ + this_##NAME.pointer->updateConfigurations(); \ + } \ } \ return this_##NAME.pointer; \ } @@ -75,15 +76,7 @@ Q_GLOBAL_STATIC_QAPP_DESTRUCTION(QNetworkConfigurationManagerPrivate, connManage QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() { - static bool initialized = false; - - QNetworkConfigurationManagerPrivate *m = connManager(); - if (!initialized) { - initialized = true; - m->updateConfigurations(); - } - - return m; + return connManager(); } /*! -- cgit v0.12