58 lines
2.5 KiB
Diff
58 lines
2.5 KiB
Diff
|
From 4d3b9aa83cf7f6d9f9b88d9936e5980629daac2a Mon Sep 17 00:00:00 2001
|
||
|
From: Cristiano di Flora <cristiano.di-flora@nokia.com>
|
||
|
Date: Tue, 22 Feb 2011 05:27:51 +0200
|
||
|
Subject: [PATCH] Fix QNetworkConfigurationManager crash due to null private pointer.
|
||
|
|
||
|
Reviewed-by: Aaron McCarthy
|
||
|
Task-Number: QTBUG-17305
|
||
|
(cherry picked from commit 7388fcb83592a90aace054314e0c3e7e7a94fdae)
|
||
|
---
|
||
|
src/network/bearer/qnetworkconfigmanager.cpp | 17 +++++------------
|
||
|
1 files changed, 5 insertions(+), 12 deletions(-)
|
||
|
|
||
|
diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp
|
||
|
index 0e3c519..7eadb82 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();
|
||
|
}
|
||
|
|
||
|
/*!
|
||
|
--
|
||
|
1.6.1
|
||
|
|