diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2011-06-21 14:50:08 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 19:49:52 +0100 |
commit | 702b4cb5d464ac5abb97a3e75601b6a946673ee4 (patch) | |
tree | 99629ff372575e97070b73b44f250717b6fab5a8 /src/plugins/bearer/generic/qgenericengine.cpp | |
parent | b5b41c18345719612e5411cc482466d2dbafdaf7 (diff) | |
download | qtbase-702b4cb5d464ac5abb97a3e75601b6a946673ee4.tar.gz |
Workaround webkit deadlock on macos x
The webkit AtomicallyInitializedStatic and Qt's Q_GLOBAL_STATIC can
deadlock on the Mac, as the mac compiler inserts calls to
__cxa_guard_acquire and __cxa_guard_release around initialisation of
local statics.
In Q_GLOBAL_STATIC case, this is the QGlobalStaticDeleter local static
Whereas webkit AtomicallyInitializedStatic is a local static variable
in any case.
Problem is triggered because webkit constructs QNetworkConfigurationManager
inside the constructor of a local static - networkStateNotifier
And the generic bearer plugin calls QNetworkInterface::allInterfaces
in the bearer thread, which needs an initialised Q_GLOBAL_STATIC.
Reviewed-by: Laszlo Agocs
(cherry picked from commit 38db40d9a2db44e47b0aabd9487284cd1106b353)
Task-number: QTBUG-24554
Change-Id: Id2c7818faefb46e66b0bbc30ce30595d46d53016
Reviewed-by: Zeno Albisser <zeno.albisser@nokia.com>
Diffstat (limited to 'src/plugins/bearer/generic/qgenericengine.cpp')
-rw-r--r-- | src/plugins/bearer/generic/qgenericengine.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 7b30b5d64c..5682d113ef 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -147,6 +147,9 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf QGenericEngine::QGenericEngine(QObject *parent) : QBearerEngineImpl(parent) { + //workaround for deadlock in __cxa_guard_acquire with webkit on macos x + //initialise the Q_GLOBAL_STATIC in same thread as the AtomicallyInitializedStatic + (void)QNetworkInterface::interfaceFromIndex(0); } QGenericEngine::~QGenericEngine() |