Merge remote-tracking branch 'origin/5.5' into 5.6

Conflicts:
	src/network/socket/qnativesocketengine_p.h
	src/network/ssl/qsslsocket_mac.cpp
	src/network/ssl/qsslsocket_mac_p.h
	src/widgets/kernel/qwidget.cpp

Change-Id: I39592cb37d710dfaf8640769ba3c1b637927d7f4
This commit is contained in:
Liang Qi 2015-11-27 08:35:45 +01:00
commit 8c57e8c012
18 changed files with 460 additions and 136 deletions

View File

@ -64,7 +64,13 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory
swapChainDesc.Windowed = TRUE; swapChainDesc.Windowed = TRUE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
return factory->CreateSwapChain(device, &swapChainDesc, swapChain); const HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain);
if (SUCCEEDED(result))
{
const HRESULT makeWindowAssociationResult = factory->MakeWindowAssociation(mWindow, DXGI_MWA_NO_ALT_ENTER);
UNUSED_TRACE_VARIABLE(makeWindowAssociationResult);
}
return result;
} }
#endif #endif
} }

View File

@ -0,0 +1,36 @@
From 00f0a46199b622b05619f56e29f172fb61fe6e82 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Date: Mon, 23 Nov 2015 14:00:02 +0100
Subject: [PATCH] ANGLE/D3D11: Suppress keyboard handling of DXGI.
Set the DXGI_MWA_NO_ALT_ENTER to suppress the Alt-Enter shortcut
causing the window to become full screen.
Task-number: QTBUG-44904
Change-Id: Ia4156ddee37a8a3da6e9e3130022c63a674f4429
---
.../angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp
index 0a4f45b..696dfd7 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow.cpp
@@ -64,7 +64,13 @@ HRESULT NativeWindow::createSwapChain(ID3D11Device* device, DXGIFactory* factory
swapChainDesc.Windowed = TRUE;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
- return factory->CreateSwapChain(device, &swapChainDesc, swapChain);
+ const HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain);
+ if (SUCCEEDED(result))
+ {
+ const HRESULT makeWindowAssociationResult = factory->MakeWindowAssociation(mWindow, DXGI_MWA_NO_ALT_ENTER);
+ UNUSED_TRACE_VARIABLE(makeWindowAssociationResult);
+ }
+ return result;
}
#endif
}
--
2.5.0.windows.1

View File

@ -6,7 +6,6 @@ HEADERS += \
arch/qatomic_armv7.h \ arch/qatomic_armv7.h \
arch/qatomic_bootstrap.h \ arch/qatomic_bootstrap.h \
arch/qatomic_ia64.h \ arch/qatomic_ia64.h \
arch/qatomic_mips.h \
arch/qatomic_x86.h \ arch/qatomic_x86.h \
arch/qatomic_gcc.h \ arch/qatomic_gcc.h \
arch/qatomic_cxx11.h arch/qatomic_cxx11.h

View File

@ -204,7 +204,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
CFRelease(bundleUrl); CFRelease(bundleUrl);
CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle); CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
CFStringRef cfResourcesPath = CFURLCopyPath(bundleUrl); CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl);
QString resourcesPath = QCFString::toQString(cfResourcesPath); QString resourcesPath = QCFString::toQString(cfResourcesPath);
CFRelease(cfResourcesPath); CFRelease(cfResourcesPath);
CFRelease(resourcesUrl); CFRelease(resourcesUrl);

View File

@ -75,8 +75,15 @@ public:
~QPlatformBackingStorePrivate() ~QPlatformBackingStorePrivate()
{ {
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
if (blitter) QOpenGLContext *ctx = QOpenGLContext::currentContext();
blitter->destroy(); if (ctx) {
if (textureId)
ctx->functions()->glDeleteTextures(1, &textureId);
if (blitter)
blitter->destroy();
} else if (textureId || blitter) {
qWarning("No context current during QPlatformBackingStore destruction, OpenGL resources not released");
}
delete blitter; delete blitter;
#endif #endif
} }

View File

@ -672,6 +672,24 @@ int QNativeSocketEngine::accept()
return d->nativeAccept(); return d->nativeAccept();
} }
/*!
Returns the number of bytes that are currently available for
reading. On error, -1 is returned.
For UDP sockets, this function returns the accumulated size of all
pending datagrams, and it is therefore more useful for UDP sockets
to call hasPendingDatagrams() and pendingDatagramSize().
*/
qint64 QNativeSocketEngine::bytesAvailable() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
return d->nativeBytesAvailable();
}
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE #ifndef QT_NO_NETWORKINTERFACE
/*! /*!
@ -733,23 +751,6 @@ bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface)
#endif // QT_NO_NETWORKINTERFACE #endif // QT_NO_NETWORKINTERFACE
/*!
Returns the number of bytes that are currently available for
reading. On error, -1 is returned.
For UDP sockets, this function returns the accumulated size of all
pending datagrams, and it is therefore more useful for UDP sockets
to call hasPendingDatagrams() and pendingDatagramSize().
*/
qint64 QNativeSocketEngine::bytesAvailable() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
return d->nativeBytesAvailable();
}
/*! /*!
Returns \c true if there is at least one datagram pending. This Returns \c true if there is at least one datagram pending. This
function is only called by UDP sockets, where a datagram can have function is only called by UDP sockets, where a datagram can have
@ -834,6 +835,7 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size, const Q
return d->nativeSendDatagram(data, size, header); return d->nativeSendDatagram(data, size, header);
} }
#endif // QT_NO_UDPSOCKET
/*! /*!
Writes a block of \a size bytes from \a data to the socket. Writes a block of \a size bytes from \a data to the socket.

View File

@ -124,6 +124,12 @@ public:
int accept() Q_DECL_OVERRIDE; int accept() Q_DECL_OVERRIDE;
void close() Q_DECL_OVERRIDE; void close() Q_DECL_OVERRIDE;
qint64 bytesAvailable() const Q_DECL_OVERRIDE;
qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE #ifndef QT_NO_NETWORKINTERFACE
bool joinMulticastGroup(const QHostAddress &groupAddress, bool joinMulticastGroup(const QHostAddress &groupAddress,
const QNetworkInterface &iface) Q_DECL_OVERRIDE; const QNetworkInterface &iface) Q_DECL_OVERRIDE;
@ -133,16 +139,12 @@ public:
bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE; bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
#endif #endif
qint64 bytesAvailable() const Q_DECL_OVERRIDE;
qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0, qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE; PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE; qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
bool hasPendingDatagrams() const Q_DECL_OVERRIDE; bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
qint64 pendingDatagramSize() const Q_DECL_OVERRIDE; qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
#endif // QT_NO_UDPSOCKET
qint64 bytesToWrite() const Q_DECL_OVERRIDE; qint64 bytesToWrite() const Q_DECL_OVERRIDE;

View File

@ -51,12 +51,291 @@
#include <algorithm> #include <algorithm>
#include <cstddef> #include <cstddef>
#include <QtCore/private/qcore_mac_p.h>
#ifdef Q_OS_OSX #ifdef Q_OS_OSX
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static SSLContextRef qt_createSecureTransportContext(QSslSocket::SslMode mode)
{
const bool isServer = mode == QSslSocket::SslServerMode;
SSLContextRef context = Q_NULLPTR;
#ifndef Q_OS_OSX
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
if (!context)
qCWarning(lcSsl) << "SSLCreateContext failed";
#else // Q_OS_OSX
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
if (!context)
qCWarning(lcSsl) << "SSLCreateContext failed";
} else {
#else
{
#endif
const OSStatus errCode = SSLNewContext(isServer, &context);
if (errCode != noErr || !context)
qCWarning(lcSsl) << "SSLNewContext failed with error:" << errCode;
}
#endif // !Q_OS_OSX
return context;
}
static void qt_releaseSecureTransportContext(SSLContextRef context)
{
if (!context)
return;
#ifndef Q_OS_OSX
CFRelease(context);
#else
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
CFRelease(context);
} else {
#else
{
#endif // QT_MAC_PLATFORM_...
const OSStatus errCode = SSLDisposeContext(context);
if (errCode != noErr)
qCWarning(lcSsl) << "SSLDisposeContext failed with error:" << errCode;
}
#endif // !Q_OS_OSX
}
static bool qt_setSessionProtocol(SSLContextRef context, const QSslConfigurationPrivate &configuration,
QTcpSocket *plainSocket)
{
Q_ASSERT(context);
#ifndef QSSLSOCKET_DEBUG
Q_UNUSED(plainSocket)
#endif
OSStatus err = noErr;
#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_5_0)
if (configuration.protocol == QSsl::SslV3) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
#endif
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kSSLProtocol3);
} else if (configuration.protocol == QSsl::TlsV1_0) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol1);
} else if (configuration.protocol == QSsl::TlsV1_1) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol11);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol11);
} else if (configuration.protocol == QSsl::TlsV1_2) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol12);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::AnyProtocol) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : any";
#endif
// kSSLProtocol3, since kSSLProtocol2 is disabled:
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1SslV3) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::SecureProtocols) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1_0OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1_1OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol11);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1_2OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol12);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration";
#endif
return false;
}
#endif
return err == noErr;
}
#ifdef Q_OS_OSX
static bool qt_setSessionProtocolOSX(SSLContextRef context, const QSslConfigurationPrivate &configuration,
QTcpSocket *plainSocket)
{
// This function works with (now) deprecated API that does not even exist on
// iOS but is the only API we have on OS X below 10.8
// Without SSLSetProtocolVersionMin/Max functions it's quite difficult
// to have the required result:
// If we use SSLSetProtocolVersion - any constant except the ones with 'Only' suffix -
// allows a negotiation and we can not set the lower limit.
// SSLSetProtocolVersionEnabled supports only a limited subset of constants, if you believe their docs:
// kSSLProtocol2
// kSSLProtocol3
// kTLSProtocol1
// kSSLProtocolAll
// Here we can only have a look into the SecureTransport's code and hope that what we see there
// and what we have on 10.7 is similar:
// SSLSetProtocoLVersionEnabled actually accepts other constants also,
// called twice with two different protocols it sets a range,
// called once with a protocol (when all protocols were disabled)
// - only this protocol is enabled (without a lower limit negotiation).
Q_ASSERT(context);
#ifndef QSSLSOCKET_DEBUG
Q_UNUSED(plainSocket)
#endif
OSStatus err = noErr;
// First, disable ALL:
if (SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, false) != noErr)
return false;
if (configuration.protocol == QSsl::SslV3) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3";
#endif
err = SSLSetProtocolVersion(context, kSSLProtocol3Only);
} else if (configuration.protocol == QSsl::TlsV1_0) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0";
#endif
err = SSLSetProtocolVersion(context, kTLSProtocol1Only);
} else if (configuration.protocol == QSsl::TlsV1_1) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true);
} else if (configuration.protocol == QSsl::TlsV1_2) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
} else if (configuration.protocol == QSsl::AnyProtocol) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : any";
#endif
err = SSLSetProtocolVersionEnabled(context, kSSLProtocolAll, true);
} else if (configuration.protocol == QSsl::TlsV1SslV3) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
if (err == noErr)
err = SSLSetProtocolVersionEnabled(context, kSSLProtocol3, true);
} else if (configuration.protocol == QSsl::SecureProtocols) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
if (err == noErr)
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true);
} else if (configuration.protocol == QSsl::TlsV1_0OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
if (err == noErr)
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol1, true);
} else if (configuration.protocol == QSsl::TlsV1_1OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
if (err == noErr)
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol11, true);
} else if (configuration.protocol == QSsl::TlsV1_2OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
#endif
err = SSLSetProtocolVersionEnabled(context, kTLSProtocol12, true);
} else {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration";
#endif
return false;
}
return err == noErr;
}
#endif // Q_OS_OSX
QSecureTransportContext::QSecureTransportContext(SSLContextRef c)
: context(c)
{
}
QSecureTransportContext::~QSecureTransportContext()
{
qt_releaseSecureTransportContext(context);
}
QSecureTransportContext::operator SSLContextRef()const
{
return context;
}
void QSecureTransportContext::reset(SSLContextRef newContext)
{
qt_releaseSecureTransportContext(context);
context = newContext;
}
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_securetransport_mutex, (QMutex::Recursive)) Q_GLOBAL_STATIC_WITH_ARGS(QMutex, qt_securetransport_mutex, (QMutex::Recursive))
//#define QSSLSOCKET_DEBUG //#define QSSLSOCKET_DEBUG
@ -144,7 +423,7 @@ void QSslSocketPrivate::ensureInitialized()
// from QSslCertificatePrivate's ctor. // from QSslCertificatePrivate's ctor.
s_loadedCiphersAndCerts = true; s_loadedCiphersAndCerts = true;
QCFType<SSLContextRef> context(SSLCreateContext(Q_NULLPTR, kSSLClientSide, kSSLStreamType)); const QSecureTransportContext context(qt_createSecureTransportContext(QSslSocket::SslClientMode));
if (context) { if (context) {
QList<QSslCipher> ciphers; QList<QSslCipher> ciphers;
QList<QSslCipher> defaultCiphers; QList<QSslCipher> defaultCiphers;
@ -171,7 +450,6 @@ void QSslSocketPrivate::ensureInitialized()
if (!s_loadRootCertsOnDemand) if (!s_loadRootCertsOnDemand)
setDefaultCaCertificates(systemCaCertificates()); setDefaultCaCertificates(systemCaCertificates());
} else { } else {
qCWarning(lcSsl) << "SSLCreateContext failed";
s_loadedCiphersAndCerts = false; s_loadedCiphersAndCerts = false;
} }
@ -656,11 +934,7 @@ bool QSslSocketBackendPrivate::initSslContext()
Q_ASSERT_X(!context, Q_FUNC_INFO, "invalid socket state, context is not null"); Q_ASSERT_X(!context, Q_FUNC_INFO, "invalid socket state, context is not null");
Q_ASSERT(plainSocket); Q_ASSERT(plainSocket);
SSLProtocolSide side = kSSLClientSide; context.reset(qt_createSecureTransportContext(mode));
if (mode == QSslSocket::SslServerMode)
side = kSSLServerSide;
context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
if (!context) { if (!context) {
setErrorAndEmit(QAbstractSocket::SslInternalError, "SSLCreateContext failed"); setErrorAndEmit(QAbstractSocket::SslInternalError, "SSLCreateContext failed");
return false; return false;
@ -756,7 +1030,7 @@ bool QSslSocketBackendPrivate::initSslContext()
void QSslSocketBackendPrivate::destroySslContext() void QSslSocketBackendPrivate::destroySslContext()
{ {
context = Q_NULLPTR; context.reset(Q_NULLPTR);
} }
static QByteArray _q_makePkcs12(const QList<QSslCertificate> &certs, const QSslKey &key, const QString &passPhrase); static QByteArray _q_makePkcs12(const QList<QSslCertificate> &certs, const QSslKey &key, const QString &passPhrase);
@ -853,8 +1127,6 @@ bool QSslSocketBackendPrivate::setSessionProtocol()
{ {
Q_ASSERT_X(context, Q_FUNC_INFO, "invalid SSL context (null)"); Q_ASSERT_X(context, Q_FUNC_INFO, "invalid SSL context (null)");
OSStatus err = noErr;
// QSsl::SslV2 == kSSLProtocol2 is disabled in secure transport and // QSsl::SslV2 == kSSLProtocol2 is disabled in secure transport and
// always fails with errSSLIllegalParam: // always fails with errSSLIllegalParam:
// if (version < MINIMUM_STREAM_VERSION || version > MAXIMUM_STREAM_VERSION) // if (version < MINIMUM_STREAM_VERSION || version > MAXIMUM_STREAM_VERSION)
@ -865,85 +1137,20 @@ bool QSslSocketBackendPrivate::setSessionProtocol()
return false; return false;
} }
if (configuration.protocol == QSsl::SslV3) { #ifndef Q_OS_OSX
#ifdef QSSLSOCKET_DEBUG return qt_setSessionProtocol(context, configuration, plainSocket);
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3"; #else
#endif
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kSSLProtocol3);
} else if (configuration.protocol == QSsl::TlsV1_0) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.0";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol1);
} else if (configuration.protocol == QSsl::TlsV1_1) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol11);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol11);
} else if (configuration.protocol == QSsl::TlsV1_2) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol12);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::AnyProtocol) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : any";
#endif
// kSSLProtocol3, since kSSLProtocol2 is disabled:
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1SslV3) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : SSLv3 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kSSLProtocol3);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::SecureProtocols) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1_0OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol1);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1_1OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.1 - TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol11);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else if (configuration.protocol == QSsl::TlsV1_2OrLater) {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "requesting : TLSv1.2";
#endif
err = SSLSetProtocolVersionMin(context, kTLSProtocol12);
if (err == noErr)
err = SSLSetProtocolVersionMax(context, kTLSProtocol12);
} else {
#ifdef QSSLSOCKET_DEBUG
qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration";
#endif
return false;
}
return err == noErr; #if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_NA)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_8) {
return qt_setSessionProtocol(context, configuration, plainSocket);
} else {
#else
{
#endif
return qt_setSessionProtocolOSX(context, configuration, plainSocket);
}
#endif
} }
bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const

View File

@ -45,8 +45,6 @@
// We mean it. // We mean it.
// //
#include <QtCore/private/qcore_mac_p.h>
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#include <QtCore/qlist.h> #include <QtCore/qlist.h>
@ -59,6 +57,20 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QSecureTransportContext
{
public:
explicit QSecureTransportContext(SSLContextRef context);
~QSecureTransportContext();
operator SSLContextRef () const;
void reset(SSLContextRef newContext);
private:
SSLContextRef context;
Q_DISABLE_COPY(QSecureTransportContext);
};
class QSslSocketBackendPrivate : public QSslSocketPrivate class QSslSocketBackendPrivate : public QSslSocketPrivate
{ {
Q_DECLARE_PUBLIC(QSslSocket) Q_DECLARE_PUBLIC(QSslSocket)
@ -76,8 +88,8 @@ public:
void startServerEncryption() Q_DECL_OVERRIDE; void startServerEncryption() Q_DECL_OVERRIDE;
void transmit() Q_DECL_OVERRIDE; void transmit() Q_DECL_OVERRIDE;
static QList<QSslError> (verify)(QList<QSslCertificate> certificateChain, static QList<QSslError> verify(QList<QSslCertificate> certificateChain,
const QString &hostName); const QString &hostName);
static bool importPkcs12(QIODevice *device, static bool importPkcs12(QIODevice *device,
QSslKey *key, QSslCertificate *cert, QSslKey *key, QSslCertificate *cert,
@ -101,7 +113,7 @@ private:
bool checkSslErrors(); bool checkSslErrors();
bool startHandshake(); bool startHandshake();
mutable QCFType<SSLContextRef> context; QSecureTransportContext context;
Q_DISABLE_COPY(QSslSocketBackendPrivate); Q_DISABLE_COPY(QSslSocketBackendPrivate);
}; };

View File

@ -71,6 +71,7 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window)
: QPlatformBackingStore(window), : QPlatformBackingStore(window),
m_window(window), m_window(window),
m_bsTexture(0), m_bsTexture(0),
m_bsTextureContext(0),
m_textures(new QPlatformTextureList), m_textures(new QPlatformTextureList),
m_lockedWidgetTextures(0) m_lockedWidgetTextures(0)
{ {
@ -78,6 +79,14 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window)
QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore() QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore()
{ {
if (m_bsTexture) {
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (ctx && m_bsTextureContext && ctx->shareGroup() == m_bsTextureContext->shareGroup())
glDeleteTextures(1, &m_bsTexture);
else
qWarning("QOpenGLCompositorBackingStore: Texture is not valid in the current context");
}
delete m_textures; delete m_textures;
} }
@ -89,6 +98,8 @@ QPaintDevice *QOpenGLCompositorBackingStore::paintDevice()
void QOpenGLCompositorBackingStore::updateTexture() void QOpenGLCompositorBackingStore::updateTexture()
{ {
if (!m_bsTexture) { if (!m_bsTexture) {
m_bsTextureContext = QOpenGLContext::currentContext();
Q_ASSERT(m_bsTextureContext);
glGenTextures(1, &m_bsTexture); glGenTextures(1, &m_bsTexture);
glBindTexture(GL_TEXTURE_2D, m_bsTexture); glBindTexture(GL_TEXTURE_2D, m_bsTexture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@ -83,6 +83,7 @@ private:
QImage m_image; QImage m_image;
QRegion m_dirty; QRegion m_dirty;
uint m_bsTexture; uint m_bsTexture;
QOpenGLContext *m_bsTextureContext;
QPlatformTextureList *m_textures; QPlatformTextureList *m_textures;
QPlatformTextureList *m_lockedWidgetTextures; QPlatformTextureList *m_lockedWidgetTextures;
}; };

View File

@ -1,5 +1,7 @@
TEMPLATE = subdirs TEMPLATE = subdirs
load(qfeatures)
contains(QT_CONFIG, evdev) { contains(QT_CONFIG, evdev) {
SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet
} }
@ -8,7 +10,9 @@ contains(QT_CONFIG, tslib) {
SUBDIRS += tslib SUBDIRS += tslib
} }
SUBDIRS += tuiotouch !contains(QT_DISABLED_FEATURES, udpsocket) {
SUBDIRS += tuiotouch
}
contains(QT_CONFIG, libinput) { contains(QT_CONFIG, libinput) {
SUBDIRS += libinput SUBDIRS += libinput

View File

@ -351,6 +351,7 @@
{ {
QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers);
QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers);
QWindowSystemInterface::flushWindowSystemEvents();
} }
#ifndef QT_NO_SHORTCUT #ifndef QT_NO_SHORTCUT
@ -898,7 +899,6 @@
// UITextInput selects the text to be deleted before calling this method. To avoid // UITextInput selects the text to be deleted before calling this method. To avoid
// drawing the selection, we flush after posting the key press/release. // drawing the selection, we flush after posting the key press/release.
[self sendKeyPressRelease:Qt::Key_Backspace modifiers:Qt::NoModifier]; [self sendKeyPressRelease:Qt::Key_Backspace modifiers:Qt::NoModifier];
QWindowSystemInterface::flushWindowSystemEvents();
} }
@end @end

View File

@ -1633,7 +1633,7 @@ void QWin32PrintEnginePrivate::updatePageLayout()
// Update orientation first as is needed to obtain printable margins when changing page size // Update orientation first as is needed to obtain printable margins when changing page size
m_pageLayout.setOrientation(devMode->dmOrientation == DMORIENT_LANDSCAPE ? QPageLayout::Landscape : QPageLayout::Portrait); m_pageLayout.setOrientation(devMode->dmOrientation == DMORIENT_LANDSCAPE ? QPageLayout::Landscape : QPageLayout::Portrait);
if (devMode->dmPaperSize >= DMPAPER_USER) { if (devMode->dmPaperSize >= DMPAPER_LAST) {
// Is a custom size // Is a custom size
QPageSize pageSize = QPageSize(QSizeF(devMode->dmPaperWidth / 10.0f, devMode->dmPaperLength / 10.0f), QPageSize pageSize = QPageSize(QSizeF(devMode->dmPaperWidth / 10.0f, devMode->dmPaperLength / 10.0f),
QPageSize::Millimeter); QPageSize::Millimeter);

View File

@ -1971,6 +1971,8 @@ void QFileDialog::setIconProvider(QFileIconProvider *provider)
QFileIconProvider *QFileDialog::iconProvider() const QFileIconProvider *QFileDialog::iconProvider() const
{ {
Q_D(const QFileDialog); Q_D(const QFileDialog);
if (!d->model)
return Q_NULLPTR;
return d->model->iconProvider(); return d->model->iconProvider();
} }

View File

@ -2241,8 +2241,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous)
QApplication::setActiveWindow(tlw); QApplication::setActiveWindow(tlw);
// QTBUG-37126, Active X controls may set the focus on native child widgets. // QTBUG-37126, Active X controls may set the focus on native child widgets.
if (wnd && tlw && wnd != tlw->windowHandle()) { if (wnd && tlw && wnd != tlw->windowHandle()) {
if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd)) if (QWidgetWindow *widgetWindow = qobject_cast<QWidgetWindow *>(wnd)) {
widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason); if (widgetWindow->widget()->inherits("QAxHostWidget"))
widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason);
}
} }
} }

View File

@ -73,6 +73,7 @@
#include <QtGui/qinputmethod.h> #include <QtGui/qinputmethod.h>
#include <QtGui/qopenglcontext.h> #include <QtGui/qopenglcontext.h>
#include <QtGui/private/qopenglcontext_p.h> #include <QtGui/private/qopenglcontext_p.h>
#include <QtGui/qoffscreensurface.h>
#include <private/qgraphicseffect_p.h> #include <private/qgraphicseffect_p.h>
#include <qbackingstore.h> #include <qbackingstore.h>
@ -1822,26 +1823,49 @@ void QWidgetPrivate::deleteSysExtra()
{ {
} }
static void deleteBackingStore(QWidgetPrivate *d)
{
QTLWExtra *topData = d->topData();
// The context must be current when destroying the backing store as it may attempt to
// release resources like textures and shader programs. The window may not be suitable
// anymore as there will often not be a platform window underneath at this stage. Fall
// back to a QOffscreenSurface in this case.
QScopedPointer<QOffscreenSurface> tempSurface;
#ifndef QT_NO_OPENGL
if (d->textureChildSeen && topData->shareContext) {
if (topData->window->handle()) {
topData->shareContext->makeCurrent(topData->window);
} else {
tempSurface.reset(new QOffscreenSurface);
tempSurface->setFormat(topData->shareContext->format());
tempSurface->create();
topData->shareContext->makeCurrent(tempSurface.data());
}
}
#endif
delete topData->backingStore;
topData->backingStore = 0;
#ifndef QT_NO_OPENGL
if (d->textureChildSeen && topData->shareContext)
topData->shareContext->doneCurrent();
#endif
}
void QWidgetPrivate::deleteTLSysExtra() void QWidgetPrivate::deleteTLSysExtra()
{ {
if (extra && extra->topextra) { if (extra && extra->topextra) {
//the qplatformbackingstore may hold a reference to the window, so the backingstore //the qplatformbackingstore may hold a reference to the window, so the backingstore
//needs to be deleted first. If the backingstore holds GL resources, we need to //needs to be deleted first. If the backingstore holds GL resources, we need to
// make the context current here, since the platform bs does not have a reference // make the context current here. This is taken care of by deleteBackingStore().
// to the widget.
#ifndef QT_NO_OPENGL
if (textureChildSeen && extra->topextra->shareContext)
extra->topextra->shareContext->makeCurrent(extra->topextra->window);
#endif
extra->topextra->backingStoreTracker.destroy(); extra->topextra->backingStoreTracker.destroy();
delete extra->topextra->backingStore; deleteBackingStore(this);
extra->topextra->backingStore = 0;
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
qDeleteAll(extra->topextra->widgetTextures); qDeleteAll(extra->topextra->widgetTextures);
extra->topextra->widgetTextures.clear(); extra->topextra->widgetTextures.clear();
if (textureChildSeen && extra->topextra->shareContext)
extra->topextra->shareContext->doneCurrent();
delete extra->topextra->shareContext; delete extra->topextra->shareContext;
extra->topextra->shareContext = 0; extra->topextra->shareContext = 0;
#endif #endif
@ -12013,7 +12037,7 @@ void QWidget::setBackingStore(QBackingStore *store)
return; return;
QBackingStore *oldStore = topData->backingStore; QBackingStore *oldStore = topData->backingStore;
delete topData->backingStore; deleteBackingStore(d);
topData->backingStore = store; topData->backingStore = store;
QWidgetBackingStore *bs = d->maybeBackingStore(); QWidgetBackingStore *bs = d->maybeBackingStore();

View File

@ -165,6 +165,7 @@ private slots:
#endif // QT_BUILD_INTERNAL #endif // QT_BUILD_INTERNAL
#endif #endif
void rejectModalDialogs(); void rejectModalDialogs();
void QTBUG49600_nativeIconProviderCrash();
private: private:
void cleanupSettingsFile(); void cleanupSettingsFile();
@ -1487,5 +1488,13 @@ void tst_QFiledialog::rejectModalDialogs()
QVERIFY(file.isEmpty()); QVERIFY(file.isEmpty());
} }
void tst_QFiledialog::QTBUG49600_nativeIconProviderCrash()
{
if (!QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog))
QSKIP("This platform always uses widgets to realize its QFileDialog, instead of the native file dialog.");
QFileDialog fd;
fd.iconProvider();
}
QTEST_MAIN(tst_QFiledialog) QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc" #include "tst_qfiledialog.moc"