Be more defensive in Qt5Network code.

It's possible, but rather unlikely, to build Qt5Network with
QT_NO_NETWORKINTERFACE, and still get around to building the
generic bearer. In that case, comment out the workaround
that needs an interface.

PR:		232784
Obtained from:	Max Steciuk
This commit is contained in:
Adriaan de Groot 2018-12-31 22:30:00 +00:00
parent 095f611cba
commit 9b65d68e26
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=488842
2 changed files with 17 additions and 5 deletions

View file

@ -2,7 +2,7 @@
PORTNAME= network
DISTVERSION= ${QT5_VERSION}
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= net ipv6
PKGNAMEPREFIX= qt5-

View file

@ -5,9 +5,9 @@ If getting the HW address succeeds, assume it's Ethernet. Tested
with two Ethernet cards and a vlan (all of which have a MAC reported
by ifconfig).
--- src/plugins/bearer/generic/qgenericengine.cpp.orig 2018-12-03 12:15:26.000000000 +0100
+++ src/plugins/bearer/generic/qgenericengine.cpp 2018-12-23 12:42:48.095145000 +0100
@@ -82,7 +82,7 @@
--- src/plugins/bearer/generic/qgenericengine.cpp.orig 2018-12-03 11:15:26 UTC
+++ src/plugins/bearer/generic/qgenericengine.cpp
@@ -82,7 +82,7 @@ using namespace ABI::Windows::Networking::Connectivity
// needed as interface is used as parameter name in qGetInterfaceType
#undef interface
@ -16,7 +16,7 @@ by ifconfig).
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
@@ -139,6 +139,23 @@
@@ -139,6 +139,23 @@ static QNetworkConfiguration::BearerType qGetInterface
if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER)
return QNetworkConfiguration::BearerEthernet;
@ -40,3 +40,15 @@ by ifconfig).
#elif defined(Q_OS_WINRT)
ComPtr<INetworkInformationStatics> networkInfoStatics;
HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics);
@@ -231,9 +248,11 @@ static QNetworkConfiguration::BearerType qGetInterface
QGenericEngine::QGenericEngine(QObject *parent)
: QBearerEngineImpl(parent)
{
+#ifndef QT_NO_NETWORKINTERFACE
//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);
+#endif
}
QGenericEngine::~QGenericEngine()