From be2e993a9ac03a6fc43b2fa15f3df068984acd70 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 22 Oct 2015 20:04:21 +0300 Subject: Fix build with 'udpsocket' feature disabled Wrap related code in QNativeSocketEngine and the tuiotouch plugin in conditionals. Change-Id: Ic6861b1c6a9e041fa8a50f96149f7280473a9fba Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- src/network/socket/qnativesocketengine.cpp | 36 ++++++++++++++++-------------- src/network/socket/qnativesocketengine_p.h | 12 +++++----- src/plugins/generic/generic.pro | 6 ++++- 3 files changed, 31 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 52e6922b5f..386e0e2cc7 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -651,6 +651,24 @@ int QNativeSocketEngine::accept() 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 /*! @@ -712,23 +730,6 @@ bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface) #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 function is only called by UDP sockets, where a datagram can have @@ -810,6 +811,7 @@ qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 size, Q_CHECK_TYPE(QNativeSocketEngine::writeDatagram(), QAbstractSocket::UdpSocket, -1); return d->nativeSendDatagram(data, size, d->adjustAddressProtocol(host), port); } +#endif // QT_NO_UDPSOCKET /*! Writes a block of \a size bytes from \a data to the socket. diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index 24909bf310..c49ef2c3ad 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -119,6 +119,12 @@ public: int accept() 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 bool joinMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface) Q_DECL_OVERRIDE; @@ -128,17 +134,13 @@ public: bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE; #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, QHostAddress *addr = 0, quint16 *port = 0) Q_DECL_OVERRIDE; qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr, quint16 port) Q_DECL_OVERRIDE; bool hasPendingDatagrams() const Q_DECL_OVERRIDE; qint64 pendingDatagramSize() const Q_DECL_OVERRIDE; +#endif // QT_NO_UDPSOCKET qint64 bytesToWrite() const Q_DECL_OVERRIDE; diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro index 82a4ad4ce8..0c1943b7dd 100644 --- a/src/plugins/generic/generic.pro +++ b/src/plugins/generic/generic.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs +load(qfeatures) + contains(QT_CONFIG, evdev) { SUBDIRS += evdevmouse evdevtouch evdevkeyboard evdevtablet } @@ -8,7 +10,9 @@ contains(QT_CONFIG, tslib) { SUBDIRS += tslib } -SUBDIRS += tuiotouch +!contains(QT_DISABLED_FEATURES, udpsocket) { + SUBDIRS += tuiotouch +} contains(QT_CONFIG, libinput) { SUBDIRS += libinput -- cgit v1.2.3 From bc7d0da741d1bc2ab2d36227d40d255c692a6fa5 Mon Sep 17 00:00:00 2001 From: Andrew McCann Date: Sun, 15 Nov 2015 16:29:47 -0800 Subject: OS X: Fix QStandardPaths::standardLocations() Task-number: QTBUG-49443 Change-Id: I0699dfd3cb4c710ab96c324219444c6294c9d732 Reviewed-by: Jake Petroules Reviewed-by: Milian Wolff --- src/corelib/io/qstandardpaths_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index d6126ce1c3..7b97a03db2 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -204,7 +204,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) CFRelease(bundleUrl); CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle); - CFStringRef cfResourcesPath = CFURLCopyPath(bundleUrl); + CFStringRef cfResourcesPath = CFURLCopyPath(resourcesUrl); QString resourcesPath = QCFString::toQString(cfResourcesPath); CFRelease(cfResourcesPath); CFRelease(resourcesUrl); -- cgit v1.2.3 From fe4ab7edce3863a23d5871634d93f0b855aa93ac Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 16 Nov 2015 12:07:15 +0100 Subject: iOS: always flush spontaneous key press events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we changed sending key events through QPA instead of directly to the focus object, we only flushed from deleteBackward (06be9f026). The reason was to avoid unnecessary flushes, as this in general can be a source to recursion problems. It turns out that this is also needed when sending Qt::Key_Return. The reason is that we sometimes resign first responder when the return key is pressed, which will also change the focus object in Qt. And without flushing the key event first, it will be processed after the change and therefore end up at the wrong object. It seems like the most sensible thing is to always flush upon receiving spontaneous key/text events from iOS, which is also how it was before. Task-number: QTBUG-49021 Change-Id: I44885a11275dee5039ef6a8abbcbdadc092695e7 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index c9120e848c..f3ea68cdc4 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -329,6 +329,7 @@ { QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers); + QWindowSystemInterface::flushWindowSystemEvents(); } #ifndef QT_NO_SHORTCUT @@ -875,7 +876,6 @@ // UITextInput selects the text to be deleted before calling this method. To avoid // drawing the selection, we flush after posting the key press/release. [self sendKeyPressRelease:Qt::Key_Backspace modifiers:Qt::NoModifier]; - QWindowSystemInterface::flushWindowSystemEvents(); } @end -- cgit v1.2.3 From 5a48d1d164ba507469ee1a8a682a3c194d733890 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 12 Nov 2015 17:26:21 +0100 Subject: Do not leak textures from the backing stores Neither the default nor the eglfs-specific backingstore release the OpenGL textures that are in use when render-to-texture widgets are involved. The result can be fatal on embedded devices that run out of GPU memory at after showing and closing dialogs and popups a certain number of times. Task-number: QTBUG-49363 Task-number: QTBUG-49399 Change-Id: Ia7471b037f147bcca0a4f1db5808ca348e230547 Reviewed-by: Lars Knoll Reviewed-by: Andy Nichols --- src/gui/painting/qplatformbackingstore.cpp | 4 ++ .../qopenglcompositorbackingstore.cpp | 11 ++++++ .../qopenglcompositorbackingstore_p.h | 1 + src/widgets/kernel/qwidget.cpp | 46 ++++++++++++++++------ 4 files changed, 51 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 62492980de..70ab9825e9 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -65,6 +65,10 @@ public: ~QPlatformBackingStorePrivate() { #ifndef QT_NO_OPENGL + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + Q_ASSERT(ctx); + if (textureId) + ctx->functions()->glDeleteTextures(1, &textureId); if (blitter) blitter->destroy(); delete blitter; diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp index 8ce1ed2d2b..55f8ea160c 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp @@ -67,6 +67,7 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window) : QPlatformBackingStore(window), m_window(window), m_bsTexture(0), + m_bsTextureContext(0), m_textures(new QPlatformTextureList), m_lockedWidgetTextures(0) { @@ -74,6 +75,14 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window) 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; } @@ -85,6 +94,8 @@ QPaintDevice *QOpenGLCompositorBackingStore::paintDevice() void QOpenGLCompositorBackingStore::updateTexture() { if (!m_bsTexture) { + m_bsTextureContext = QOpenGLContext::currentContext(); + Q_ASSERT(m_bsTextureContext); glGenTextures(1, &m_bsTexture); glBindTexture(GL_TEXTURE_2D, m_bsTexture); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h index 49d8bfd6e7..bd843e8bd9 100644 --- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h +++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h @@ -83,6 +83,7 @@ private: QImage m_image; QRegion m_dirty; uint m_bsTexture; + QOpenGLContext *m_bsTextureContext; QPlatformTextureList *m_textures; QPlatformTextureList *m_lockedWidgetTextures; }; diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 2d7c03116b..7c3c4fe8da 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -72,6 +72,7 @@ #include #include #include +#include #include #include @@ -1817,24 +1818,47 @@ 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 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() { if (extra && extra->topextra) { //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 - // make the context current here, since the platform bs does not have a reference - // to the widget. + // make the context current here. This is taken care of by deleteBackingStore(). -#ifndef QT_NO_OPENGL - if (textureChildSeen && extra->topextra->shareContext) - extra->topextra->shareContext->makeCurrent(extra->topextra->window); -#endif extra->topextra->backingStoreTracker.destroy(); - delete extra->topextra->backingStore; - extra->topextra->backingStore = 0; + deleteBackingStore(this); #ifndef QT_NO_OPENGL - if (textureChildSeen && extra->topextra->shareContext) - extra->topextra->shareContext->doneCurrent(); delete extra->topextra->shareContext; extra->topextra->shareContext = 0; #endif @@ -11980,7 +12004,7 @@ void QWidget::setBackingStore(QBackingStore *store) return; QBackingStore *oldStore = topData->backingStore; - delete topData->backingStore; + deleteBackingStore(d); topData->backingStore = store; QWidgetBackingStore *bs = d->maybeBackingStore(); -- cgit v1.2.3 From 7cfc24f72a80656580218dccab9b24b89a273022 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 29 Sep 2015 12:38:53 +0200 Subject: Secure Transport backend - make it work on OS X 10.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On OS X SSLCreateContext is quite recent - it requires OS X/SDK version >= 10.8. Since SecureTransport back-end is the default one in Qt 5.6, make it also work on OS X 10.7. Change-Id: I364feff9dd95772fcea926494b2d4edaffd2dde1 Reviewed-by: Morten Johan Sørvig --- src/network/ssl/qsslsocket_mac.cpp | 94 ++++++++++++++++++++++++++++++++++---- src/network/ssl/qsslsocket_mac_p.h | 22 +++++++-- 2 files changed, 103 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index b83e56c29e..6d7a26e1c0 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -51,8 +51,91 @@ #include #include +#include + +#ifdef Q_OS_OSX +#include +#endif + 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 + const OSStatus errCode = SSLDisposeContext(context); + if (errCode != noErr) + qCWarning(lcSsl) << "SSLDisposeContext failed with error:" << errCode; + } +#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)) //#define QSSLSOCKET_DEBUG @@ -140,7 +223,7 @@ void QSslSocketPrivate::ensureInitialized() // from QSslCertificatePrivate's ctor. s_loadedCiphersAndCerts = true; - QCFType context(SSLCreateContext(Q_NULLPTR, kSSLClientSide, kSSLStreamType)); + const QSecureTransportContext context(qt_createSecureTransportContext(QSslSocket::SslClientMode)); if (context) { QList ciphers; QList defaultCiphers; @@ -167,7 +250,6 @@ void QSslSocketPrivate::ensureInitialized() if (!s_loadRootCertsOnDemand) setDefaultCaCertificates(systemCaCertificates()); } else { - qCWarning(lcSsl) << "SSLCreateContext failed"; s_loadedCiphersAndCerts = false; } @@ -652,11 +734,7 @@ bool QSslSocketBackendPrivate::initSslContext() Q_ASSERT_X(!context, Q_FUNC_INFO, "invalid socket state, context is not null"); Q_ASSERT(plainSocket); - SSLProtocolSide side = kSSLClientSide; - if (mode == QSslSocket::SslServerMode) - side = kSSLServerSide; - - context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType); + context.reset(qt_createSecureTransportContext(mode)); if (!context) { setError("SSLCreateContext failed", QAbstractSocket::SslInternalError); return false; @@ -752,7 +830,7 @@ bool QSslSocketBackendPrivate::initSslContext() void QSslSocketBackendPrivate::destroySslContext() { - context = Q_NULLPTR; + context.reset(Q_NULLPTR); } static QByteArray _q_makePkcs12(const QList &certs, const QSslKey &key, const QString &passPhrase); diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h index 868b816957..0479e30d97 100644 --- a/src/network/ssl/qsslsocket_mac_p.h +++ b/src/network/ssl/qsslsocket_mac_p.h @@ -45,8 +45,6 @@ // We mean it. // -#include - #include #include #include @@ -59,6 +57,20 @@ 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 { Q_DECLARE_PUBLIC(QSslSocket) @@ -76,8 +88,8 @@ public: void startServerEncryption() Q_DECL_OVERRIDE; void transmit() Q_DECL_OVERRIDE; - static QList (verify)(QList certificateChain, - const QString &hostName); + static QList verify(QList certificateChain, + const QString &hostName); static bool importPkcs12(QIODevice *device, QSslKey *key, QSslCertificate *cert, @@ -108,7 +120,7 @@ private: void setError(const QString &errorString, QAbstractSocket::SocketError errorCode); - mutable QCFType context; + QSecureTransportContext context; Q_DISABLE_COPY(QSslSocketBackendPrivate); }; -- cgit v1.2.3 From 2010eff9d71d90953694c322ceebd340b7adef5f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 29 Sep 2015 14:40:48 +0200 Subject: Secure Transport - make it work on OS X 10.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SSLSetProtocolVersionMin/Max were introduced _only_ in 10.8 and we need a workaround for 10.7 - use SSLSetProtocolVersion or SSLSetProtocolVersionEnabled. Change-Id: I4b7ed9fda21e2c374a98fd777253280e8013ffde Reviewed-by: Morten Johan Sørvig --- src/network/ssl/qsslsocket_mac.cpp | 291 +++++++++++++++++++++++++++---------- 1 file changed, 212 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp index 6d7a26e1c0..aabae81eed 100644 --- a/src/network/ssl/qsslsocket_mac.cpp +++ b/src/network/ssl/qsslsocket_mac.cpp @@ -107,7 +107,7 @@ static void qt_releaseSecureTransportContext(SSLContextRef context) } else { #else { -#endif +#endif // QT_MAC_PLATFORM_... const OSStatus errCode = SSLDisposeContext(context); if (errCode != noErr) qCWarning(lcSsl) << "SSLDisposeContext failed with error:" << errCode; @@ -115,6 +115,206 @@ static void qt_releaseSecureTransportContext(SSLContextRef context) #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) { @@ -927,8 +1127,6 @@ bool QSslSocketBackendPrivate::setSessionProtocol() { Q_ASSERT_X(context, Q_FUNC_INFO, "invalid SSL context (null)"); - OSStatus err = noErr; - // QSsl::SslV2 == kSSLProtocol2 is disabled in secure transport and // always fails with errSSLIllegalParam: // if (version < MINIMUM_STREAM_VERSION || version > MAXIMUM_STREAM_VERSION) @@ -939,85 +1137,20 @@ bool QSslSocketBackendPrivate::setSessionProtocol() return false; } - 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); +#ifndef Q_OS_OSX + return qt_setSessionProtocol(context, configuration, plainSocket); +#else + +#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 { -#ifdef QSSLSOCKET_DEBUG - qCDebug(lcSsl) << plainSocket << "no protocol version found in the configuration"; +#else + { #endif - return false; + return qt_setSessionProtocolOSX(context, configuration, plainSocket); } - - return err == noErr; +#endif } bool QSslSocketBackendPrivate::canIgnoreTrustVerificationFailure() const -- cgit v1.2.3 From b21c219811f2363002e3cc96c8cfef849aaa95a4 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 6 Nov 2015 11:03:15 +0100 Subject: Call setFocus() if it is a QAxHostWidget which is in a new active window The change 8c0f47cfae17a39137dec47aa0b9f3f9bedad introduced a problem where if the widget was being reparented had a valid HWND then it would cause the focus to change inside the already active window. Therefore we need to limit the times it does this to the case where we know it needs to be done which is the ActiveQt case. Change-Id: Ia85f5136661142b25952e0ebf66f8a43d9500d58 Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw --- src/widgets/kernel/qapplication.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 647484ece1..078feb4b03 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2248,8 +2248,10 @@ void QApplicationPrivate::notifyActiveWindowChange(QWindow *previous) QApplication::setActiveWindow(tlw); // QTBUG-37126, Active X controls may set the focus on native child widgets. if (wnd && tlw && wnd != tlw->windowHandle()) { - if (QWidgetWindow *widgetWindow = qobject_cast(wnd)) - widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason); + if (QWidgetWindow *widgetWindow = qobject_cast(wnd)) { + if (widgetWindow->widget()->inherits("QAxHostWidget")) + widgetWindow->widget()->setFocus(Qt::ActiveWindowFocusReason); + } } } -- cgit v1.2.3 From a2f360360cbb8f567bc32d7fc1d668f238806483 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 12 Nov 2015 10:02:13 +0100 Subject: If the paper value is greater than DMPAPER_LAST then it is a custom size Ideally all printer drivers would add beyond DMPAPER_USER for their custom sizes. However some printer drivers add beyond DMPAPER_LAST instead so we need to check if the value is past DMPAPER_LAST and consider those as a custom size. Task-number: QTBUG-47272 Change-Id: I1bcb01c08fe605cc484769b0301cfcd7b8f66157 Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qprintengine_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index a4209d833a..707847ba3f 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1633,7 +1633,7 @@ void QWin32PrintEnginePrivate::updatePageLayout() // 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); - if (devMode->dmPaperSize >= DMPAPER_USER) { + if (devMode->dmPaperSize >= DMPAPER_LAST) { // Is a custom size QPageSize pageSize = QPageSize(QSizeF(devMode->dmPaperWidth / 10.0f, devMode->dmPaperLength / 10.0f), QPageSize::Millimeter); -- cgit v1.2.3 From 3811307bf125cc1140dda10af14c40418a1c967b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 23 Nov 2015 14:00:02 +0100 Subject: 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 Reviewed-by: Andrew Knight --- .../renderer/d3d/d3d11/win32/NativeWindow.cpp | 8 ++++- ...-D3D11-Suppress-keyboard-handling-of-DXGI.patch | 36 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch (limited to 'src') 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 0a4f45b5b7..696dfd72f8 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 } diff --git a/src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch b/src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch new file mode 100644 index 0000000000..2927176815 --- /dev/null +++ b/src/angle/patches/0010-ANGLE-D3D11-Suppress-keyboard-handling-of-DXGI.patch @@ -0,0 +1,36 @@ +From 00f0a46199b622b05619f56e29f172fb61fe6e82 Mon Sep 17 00:00:00 2001 +From: Friedemann Kleint +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 + -- cgit v1.2.3 From 045abe631c3b971e212f2ca5c648b086753c47c5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 23 Nov 2015 13:10:20 +0100 Subject: Remove arch/qatomic_mips.h from src/corelib/arch/arch.pri. Amend change 110a8c339fa078a4edd09a70239280e482b149f1, fixing: WARNING: Failure to find: arch/qatomic_mips.h Task-number: QTBUG-49168 Change-Id: I7009037d3f4c51c9ed9713b6e94ee43022fe2645 Reviewed-by: Dmitry Shachnev Reviewed-by: Thiago Macieira --- src/corelib/arch/arch.pri | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index 5c3b0b78c2..16fe8b8e5c 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -6,7 +6,6 @@ HEADERS += \ arch/qatomic_armv7.h \ arch/qatomic_bootstrap.h \ arch/qatomic_ia64.h \ - arch/qatomic_mips.h \ arch/qatomic_x86.h \ arch/qatomic_gcc.h \ arch/qatomic_cxx11.h -- cgit v1.2.3 From e4d1bf9829c56dc446a07689758f22c58863d70d Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Tue, 24 Nov 2015 09:51:12 +0200 Subject: Fix crash in QFileDialog::iconProvider() with native dialogs Task-number: QTBUG-49600 Change-Id: Ied28c0e7efa6b4dce25705dab98377848db5a6d3 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qfiledialog.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 2d4ba1aeb9..4e0d70fb9a 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -1938,6 +1938,8 @@ void QFileDialog::setIconProvider(QFileIconProvider *provider) QFileIconProvider *QFileDialog::iconProvider() const { Q_D(const QFileDialog); + if (!d->model) + return Q_NULLPTR; return d->model->iconProvider(); } -- cgit v1.2.3 From c83eefff976a5f2cd673f6b4a95922b13855dd29 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 24 Nov 2015 21:08:56 +0100 Subject: Remove incorrect assertion from the backingstore The ifdef gave an impression of the code path being hit only when texture-backed widgets are present and OpenGL-based compositing is active. This is false. Asserting on having a context current is wrong (as shown by autotests on the 5.6 branch). Change-Id: I2539f0aac75b26597f49f63edcd9580428be79b7 Reviewed-by: Gunnar Sletta --- src/gui/painting/qplatformbackingstore.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 70ab9825e9..22f5662c34 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -66,11 +66,14 @@ public: { #ifndef QT_NO_OPENGL QOpenGLContext *ctx = QOpenGLContext::currentContext(); - Q_ASSERT(ctx); - if (textureId) - ctx->functions()->glDeleteTextures(1, &textureId); - if (blitter) - 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; #endif } -- cgit v1.2.3