Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6

This commit is contained in:
Liang Qi 2015-10-14 11:38:53 +00:00 committed by The Qt Project
commit e7ab9a1fb9
19 changed files with 450 additions and 93 deletions

View File

@ -37,6 +37,5 @@
int main(int, char**) int main(int, char**)
{ {
gst_is_initialized();
return 0; return 0;
} }

140
dist/changes-5.5.1 vendored Normal file
View File

@ -0,0 +1,140 @@
Qt 5.5.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.5.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5.5/
The Qt version 5.5 series is binary compatible with the 5.4.x series.
Applications compiled for 5.4 will continue to run with 5.5.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
http://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- [QTBUG-47316] QDebug output for QStrings changed compared to Qt 5.5.0 to
more closely match the output of previous Qt versions. Like Qt 5.5.0,
QDebug will escape non-printable characters, the backslash and quote
characters, but will no longer escape the printable characters.
****************************************************************************
* Future Direction Notice *
****************************************************************************
- Qt 5.7 will begin requiring certain C++11 features in order to
compile. Due to bugs in the Clang compiler that comes with XCode 5.0,
that version will not be supported, despite what was noted in the Qt
5.5.0 changelog.
The minimum compiler versions for Qt 5.7 release will be:
* Clang 3.3 (XCode 5.1 contains version 3.4)
* GCC 4.7
* Intel C++ Composer XE 2013 SP1 (compiler version 14.0) on Linux and OS X
* Intel C++ Composer XE 2016 (compiler version 16.0) on Windows
* Microsoft Visual Studio 2012 (compiler version 17.0)
****************************************************************************
* Library *
****************************************************************************
QtCore
------
- Logging framework:
* Fixed a bug that would cause a
"%{time boot}" field in the logging framework's pattern to always
display the same value, instead of the time since boot.
- QDate/QTime:
* Fixed a minor source-incompatibility between Qt 5.4 and 5.5.0
involving sets of functions overloaded on QTime and some integer or
QDate and some integer.
- QDir:
* QDir::relativeFilePath() now returns "." instead of an empty string if
the given path is the same as the directory.
- QLoggingCategory:
* Fixed behavior of default severity passed to constructor or
Q_LOGGING_CATEGORY with regards to QtInfoMsg, which was previously
treated as being more severe than QtFatalMsg.
- QTimeZone:
* [QTBUG-47037] Fixed a wrong timezone conversion when the POSIX
timezone rule contains a fractional timezone (e.g. VET4:30).
QtNetwork
---------
- [QTBUG-47048] Fix HTTP issues with "Unknown Error" and "Connection
Closed"
[ChangeLog][QtNetwork][Sockets] Read OS/encrypted read buffers when
connection closed by server.
QtSql
-----
- QSqlDatabase:
* [QTBUG-47784][QTBUG-47452] Fixed a bug where opening a connection to a
MySQL database using the QMYSQL plugin would always return true even
if the server was unreachable. This bug could also lead to crashes
depending on the platform used.
QtWidgets
---------
- Important behavior changes:
* [QTBUG-46379] Tooltips on OS X are now transparent for mouse events.
****************************************************************************
* Platform Specific Changes *
****************************************************************************
Windows
-------
- Text:
* [QTBUG-46963] Fixed crash in DirectWrite engine when constructing a
QRawFont from raw font data.
****************************************************************************
* Compiler Specific Changes *
****************************************************************************
GCC
---
- Fixed a regression introduced Qt 5.5.0 that generated lots of
compiler warnings in Qt public headers when using the (deprecated)
version 4.5 of GCC.
****************************************************************************
* Tools *
****************************************************************************
configure & build system
------------------------
- [QTBUG-46125] Fixed misuse of target linker features for host tools.
- [QTBUG-46473] QML plugin DLLs now have version information.
qmake
-----
- [QTBUG-46824][Darwin] Characters in the bundle identifier which
the App Store considers invalid are now substituted.
- [QTBUG-47065][Unix] Fixed use of CONFIG+=separate_debug_info together
with CONFIG+=unversioned_libname.
- [QTBUG-47450][Xcode] Fixed Info.plist creation in shadow builds.
- [QTBUG-47775][Darwin] Fixed Info.plist creation when bundle name
contains spaces.
- [QTBUG-48110][VS] Fixed VS2015 solution file generation.
- [MSVC][nmake] Fixed use of VS2013 mkspecs from VS2015 shell.

View File

@ -57,8 +57,6 @@ public:
void render() Q_DECL_OVERRIDE; void render() Q_DECL_OVERRIDE;
private: private:
GLuint loadShader(GLenum type, const char *source);
GLuint m_posAttr; GLuint m_posAttr;
GLuint m_colAttr; GLuint m_colAttr;
GLuint m_matrixUniform; GLuint m_matrixUniform;
@ -113,14 +111,6 @@ static const char *fragmentShaderSource =
//! [3] //! [3]
//! [4] //! [4]
GLuint TriangleWindow::loadShader(GLenum type, const char *source)
{
GLuint shader = glCreateShader(type);
glShaderSource(shader, 1, &source, 0);
glCompileShader(shader);
return shader;
}
void TriangleWindow::initialize() void TriangleWindow::initialize()
{ {
m_program = new QOpenGLShaderProgram(this); m_program = new QOpenGLShaderProgram(this);

View File

@ -295,9 +295,22 @@ Renderer11::Renderer11(egl::Display *display)
#else #else
if (requestedMajorVersion == 9 && requestedMinorVersion == 3) if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
#endif #endif
{
if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
{ {
mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3); mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
} }
#if defined(ANGLE_ENABLE_WINDOWS_STORE)
if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
{
mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
}
if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
{
mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
}
#endif
}
EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE); EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE);

View File

@ -49,6 +49,8 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
// validate the attribute parameter // validate the attribute parameter
switch (attribute) switch (attribute)
{ {
case EGL_DEVICE_EXT:
break;
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE: case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!display->getExtensions().surfaceD3DTexture2DShareHandle) if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
{ {

View File

@ -0,0 +1,57 @@
From 3d696560f987a08d608b29bf3e0f557e96bebc56 Mon Sep 17 00:00:00 2001
From: Samuel Nevala <samuel.nevala@intopalo.com>
Date: Sat, 3 Oct 2015 02:30:26 +0300
Subject: [PATCH] ANGLE: Fix Windows Store D3D Trim and Level 9 requirements
Due to additional validation not covered in previous patches, the Windows
Store certification compatibility had regressed. These changes ensure that
the required D3D behaviors are met.
Change-Id: I0a74f0d2fecaa87d4a9409da3a7a194254609759
---
.../angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 16 +++++++++++++++-
.../angle/src/libGLESv2/entry_points_egl_ext.cpp | 2 ++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 5291a3a..61d9212 100644
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -296,7 +296,21 @@ Renderer11::Renderer11(egl::Display *display)
if (requestedMajorVersion == 9 && requestedMinorVersion == 3)
#endif
{
- mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 3)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_3);
+ }
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 2)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_2);
+ }
+ if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
+ {
+ mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_9_1);
+ }
+#endif
}
EGLint requestedDeviceType = attributes.get(EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE,
diff --git a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
index 62f3ca1..02b6631 100644
--- a/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
+++ b/src/3rdparty/angle/src/libGLESv2/entry_points_egl_ext.cpp
@@ -49,6 +49,8 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
// validate the attribute parameter
switch (attribute)
{
+ case EGL_DEVICE_EXT:
+ break;
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
{
--
1.9.5.msysgit.1

View File

@ -572,6 +572,9 @@
# if _MSC_VER < 1900 # if _MSC_VER < 1900
// ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active // ICC disables unicode string support when compatibility mode with MSVC 2013 or lower is active
# undef Q_COMPILER_UNICODE_STRINGS # undef Q_COMPILER_UNICODE_STRINGS
// Even though ICC knows about ref-qualified members, MSVC 2013 or lower doesn't, so
// certain member functions (like QString::toUpper) may be missing from the DLLs.
# undef Q_COMPILER_REF_QUALIFIERS
// Disable constexpr unless the MS headers have constexpr in all the right places too // Disable constexpr unless the MS headers have constexpr in all the right places too
// (like std::numeric_limits<T>::max()) // (like std::numeric_limits<T>::max())
# undef Q_COMPILER_CONSTEXPR # undef Q_COMPILER_CONSTEXPR

View File

@ -695,6 +695,62 @@ QDebug &QDebug::resetFormat()
\internal \internal
*/ */
/*!
\fn QDebug operator<<(QDebug stream, const QList<T> &list)
\relates QDebug
Writes the contents of \a list to \a stream. \c T needs to
support streaming into QDebug.
*/
/*!
\fn QDebug operator<<(QDebug stream, const QVector<T> &vector)
\relates QDebug
Writes the contents of \a vector to \a stream. \c T needs to
support streaming into QDebug.
*/
/*!
\fn QDebug operator<<(QDebug stream, const QSet<T> &set)
\relates QDebug
Writes the contents of \a set to \a stream. \c T needs to
support streaming into QDebug.
*/
/*!
\fn QDebug operator<<(QDebug stream, const QMap<Key, T> &map)
\relates QDebug
Writes the contents of \a map to \a stream. Both \c Key and
\c T need to support streaming into QDebug.
*/
/*!
\fn QDebug operator<<(QDebug stream, const QHash<Key, T> &hash)
\relates QDebug
Writes the contents of \a hash to \a stream. Both \c Key and
\c T need to support streaming into QDebug.
*/
/*!
\fn QDebug operator<<(QDebug stream, const QPair<T1, T2> &pair)
\relates QDebug
Writes the contents of \a pair to \a stream. Both \c T1 and
\c T2 need to support streaming into QDebug.
*/
/*!
\fn QDebug operator<<(QDebug stream, const QFlags<T> &flag)
\relates QDebug
\since 4.7
Writes \a flag to \a stream.
*/
/*! /*!
\class QDebugStateSaver \class QDebugStateSaver
\inmodule QtCore \inmodule QtCore

View File

@ -216,12 +216,12 @@ inline QDebug operator<<(QDebug debug, const QVector<T> &vec)
return operator<<(debug, vec.toList()); return operator<<(debug, vec.toList());
} }
template <class aKey, class aT> template <class Key, class T>
inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map) inline QDebug operator<<(QDebug debug, const QMap<Key, T> &map)
{ {
const bool oldSetting = debug.autoInsertSpaces(); const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << "QMap("; debug.nospace() << "QMap(";
for (typename QMap<aKey, aT>::const_iterator it = map.constBegin(); for (typename QMap<Key, T>::const_iterator it = map.constBegin();
it != map.constEnd(); ++it) { it != map.constEnd(); ++it) {
debug << '(' << it.key() << ", " << it.value() << ')'; debug << '(' << it.key() << ", " << it.value() << ')';
} }
@ -230,12 +230,12 @@ inline QDebug operator<<(QDebug debug, const QMap<aKey, aT> &map)
return debug.maybeSpace(); return debug.maybeSpace();
} }
template <class aKey, class aT> template <class Key, class T>
inline QDebug operator<<(QDebug debug, const QHash<aKey, aT> &hash) inline QDebug operator<<(QDebug debug, const QHash<Key, T> &hash)
{ {
const bool oldSetting = debug.autoInsertSpaces(); const bool oldSetting = debug.autoInsertSpaces();
debug.nospace() << "QHash("; debug.nospace() << "QHash(";
for (typename QHash<aKey, aT>::const_iterator it = hash.constBegin(); for (typename QHash<Key, T>::const_iterator it = hash.constBegin();
it != hash.constEnd(); ++it) it != hash.constEnd(); ++it)
debug << '(' << it.key() << ", " << it.value() << ')'; debug << '(' << it.key() << ", " << it.value() << ')';
debug << ')'; debug << ')';
@ -276,7 +276,7 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.maybeSpace(); return debug.maybeSpace();
} }
#ifndef QT_NO_QOBJECT #if !defined(QT_NO_QOBJECT) && !defined(Q_QDOC)
Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, int value, const QMetaObject *meta, const char *name); Q_CORE_EXPORT QDebug qt_QMetaEnum_debugOperator(QDebug&, int value, const QMetaObject *meta, const char *name);
Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name); Q_CORE_EXPORT QDebug qt_QMetaEnum_flagDebugOperator(QDebug &dbg, quint64 value, const QMetaObject *meta, const char *name);
@ -305,7 +305,7 @@ inline typename QtPrivate::QEnableIf<
!QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value, !QtPrivate::IsQEnumHelper<T>::Value && !QtPrivate::IsQEnumHelper<QFlags<T> >::Value,
QDebug>::Type QDebug>::Type
qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags) qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
#else // !QT_NO_QOBJECT #else // !QT_NO_QOBJECT && !Q_QDOC
template <class T> template <class T>
inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags) inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags<T> &flags)
#endif #endif

View File

@ -171,8 +171,10 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
} }
} }
// Ensure nobody else can delete the file while we have it // Ensure nobody else can delete the file while we have it
if (!setNativeLocks(fd)) if (!setNativeLocks(fd)) {
qWarning() << "setNativeLocks failed:" << strerror(errno); const int errnoSaved = errno;
qWarning() << "setNativeLocks failed:" << qt_error_string(errnoSaved);
}
if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) { if (qt_write_loop(fd, fileData.constData(), fileData.size()) < fileData.size()) {
close(fd); close(fd);

View File

@ -2464,12 +2464,14 @@ qint64 QAbstractSocket::readLineData(char *data, qint64 maxlen)
qint64 QAbstractSocket::writeData(const char *data, qint64 size) qint64 QAbstractSocket::writeData(const char *data, qint64 size)
{ {
Q_D(QAbstractSocket); Q_D(QAbstractSocket);
if (d->state == QAbstractSocket::UnconnectedState) { if (d->state == QAbstractSocket::UnconnectedState
|| (!d->socketEngine && d->socketType != TcpSocket && !d->isBuffered)) {
d->setError(UnknownSocketError, tr("Socket is not connected")); d->setError(UnknownSocketError, tr("Socket is not connected"));
return -1; return -1;
} }
if (!d->isBuffered && d->socketType == TcpSocket && d->writeBuffer.isEmpty()) { if (!d->isBuffered && d->socketType == TcpSocket
&& d->socketEngine && d->writeBuffer.isEmpty()) {
// This code is for the new Unbuffered QTcpSocket use case // This code is for the new Unbuffered QTcpSocket use case
qint64 written = d->socketEngine->write(data, size); qint64 written = d->socketEngine->write(data, size);
if (written < 0) { if (written < 0) {

View File

@ -55,12 +55,16 @@ void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CF
// notifier is now gone. The upshot is we have to check the notifier // notifier is now gone. The upshot is we have to check the notifier
// every time. // every time.
if (callbackType == kCFSocketReadCallBack) { if (callbackType == kCFSocketReadCallBack) {
if (socketInfo->readNotifier) if (socketInfo->readNotifier && socketInfo->readEnabled) {
socketInfo->readEnabled = false;
QGuiApplication::sendEvent(socketInfo->readNotifier, &notifierEvent); QGuiApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
}
} else if (callbackType == kCFSocketWriteCallBack) { } else if (callbackType == kCFSocketWriteCallBack) {
if (socketInfo->writeNotifier) if (socketInfo->writeNotifier && socketInfo->writeEnabled) {
socketInfo->writeEnabled = false;
QGuiApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent); QGuiApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent);
} }
}
if (cfSocketNotifier->maybeCancelWaitForMoreEvents) if (cfSocketNotifier->maybeCancelWaitForMoreEvents)
cfSocketNotifier->maybeCancelWaitForMoreEvents(cfSocketNotifier->eventDispatcher); cfSocketNotifier->maybeCancelWaitForMoreEvents(cfSocketNotifier->eventDispatcher);
@ -88,12 +92,12 @@ void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSource
CFRunLoopRemoveSource(CFRunLoopGetMain(), runloop, kCFRunLoopCommonModes); CFRunLoopRemoveSource(CFRunLoopGetMain(), runloop, kCFRunLoopCommonModes);
CFSocketDisableCallBacks(socket, kCFSocketReadCallBack); CFSocketDisableCallBacks(socket, kCFSocketReadCallBack);
CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack); CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack);
CFRunLoopSourceInvalidate(runloop);
} }
QCFSocketNotifier::QCFSocketNotifier() QCFSocketNotifier::QCFSocketNotifier()
: eventDispatcher(0) : eventDispatcher(0)
, maybeCancelWaitForMoreEvents(0) , maybeCancelWaitForMoreEvents(0)
, enableNotifiersObserver(0)
{ {
} }
@ -150,36 +154,34 @@ void QCFSocketNotifier::registerSocketNotifier(QSocketNotifier *notifier)
} }
CFOptionFlags flags = CFSocketGetSocketFlags(socketInfo->socket); CFOptionFlags flags = CFSocketGetSocketFlags(socketInfo->socket);
flags |= kCFSocketAutomaticallyReenableWriteCallBack; //QSocketNotifier stays enabled after a write // QSocketNotifier doesn't close the socket upon destruction/invalidation
flags &= ~kCFSocketCloseOnInvalidate; //QSocketNotifier doesn't close the socket upon destruction/invalidation flags &= ~kCFSocketCloseOnInvalidate;
// Expicitly disable automatic re-enable, as we do that manually on each runloop pass
flags &= ~(kCFSocketAutomaticallyReenableWriteCallBack | kCFSocketAutomaticallyReenableReadCallBack);
CFSocketSetSocketFlags(socketInfo->socket, flags); CFSocketSetSocketFlags(socketInfo->socket, flags);
// Add CFSocket to runloop.
if (!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
CFSocketInvalidate(socketInfo->socket);
CFRelease(socketInfo->socket);
return;
}
// Disable both callback types by default. This must be done after
// we add the CFSocket to the runloop, or else these calls will have
// no effect.
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
macSockets.insert(nativeSocket, socketInfo); macSockets.insert(nativeSocket, socketInfo);
} }
// Increment read/write counters and select enable callbacks if necessary.
if (type == QSocketNotifier::Read) { if (type == QSocketNotifier::Read) {
Q_ASSERT(socketInfo->readNotifier == 0); Q_ASSERT(socketInfo->readNotifier == 0);
socketInfo->readNotifier = notifier; socketInfo->readNotifier = notifier;
CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack); socketInfo->readEnabled = false;
} else if (type == QSocketNotifier::Write) { } else if (type == QSocketNotifier::Write) {
Q_ASSERT(socketInfo->writeNotifier == 0); Q_ASSERT(socketInfo->writeNotifier == 0);
socketInfo->writeNotifier = notifier; socketInfo->writeNotifier = notifier;
CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack); socketInfo->writeEnabled = false;
}
if (!enableNotifiersObserver) {
// Create a run loop observer which enables the socket notifiers on each
// pass of the run loop, before any sources are processed.
CFRunLoopObserverContext context = {};
context.info = this;
enableNotifiersObserver = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeSources,
true, 0, enableSocketNotifiers, &context);
Q_ASSERT(enableNotifiersObserver);
CFRunLoopAddObserver(CFRunLoopGetMain(), enableNotifiersObserver, kCFRunLoopCommonModes);
} }
} }
@ -212,21 +214,18 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
if (type == QSocketNotifier::Read) { if (type == QSocketNotifier::Read) {
Q_ASSERT(notifier == socketInfo->readNotifier); Q_ASSERT(notifier == socketInfo->readNotifier);
socketInfo->readNotifier = 0; socketInfo->readNotifier = 0;
socketInfo->readEnabled = false;
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack); CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
} else if (type == QSocketNotifier::Write) { } else if (type == QSocketNotifier::Write) {
Q_ASSERT(notifier == socketInfo->writeNotifier); Q_ASSERT(notifier == socketInfo->writeNotifier);
socketInfo->writeNotifier = 0; socketInfo->writeNotifier = 0;
socketInfo->writeEnabled = false;
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack); CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
} }
// Remove CFSocket from runloop if this was the last QSocketNotifier. // Remove CFSocket from runloop if this was the last QSocketNotifier.
if (socketInfo->readNotifier == 0 && socketInfo->writeNotifier == 0) { if (socketInfo->readNotifier == 0 && socketInfo->writeNotifier == 0) {
if (CFSocketIsValid(socketInfo->socket)) unregisterSocketInfo(socketInfo);
qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
CFRunLoopSourceInvalidate(socketInfo->runloop);
CFRelease(socketInfo->runloop);
CFSocketInvalidate(socketInfo->socket);
CFRelease(socketInfo->socket);
delete socketInfo; delete socketInfo;
macSockets.remove(nativeSocket); macSockets.remove(nativeSocket);
} }
@ -235,14 +234,70 @@ void QCFSocketNotifier::unregisterSocketNotifier(QSocketNotifier *notifier)
void QCFSocketNotifier::removeSocketNotifiers() void QCFSocketNotifier::removeSocketNotifiers()
{ {
// Remove CFSockets from the runloop. // Remove CFSockets from the runloop.
for (MacSocketHash::ConstIterator it = macSockets.constBegin(); it != macSockets.constEnd(); ++it) { foreach (MacSocketInfo *socketInfo, macSockets) {
MacSocketInfo *socketInfo = (*it); unregisterSocketInfo(socketInfo);
if (CFSocketIsValid(socketInfo->socket)) { delete socketInfo;
}
macSockets.clear();
destroyRunLoopObserver();
}
void QCFSocketNotifier::destroyRunLoopObserver()
{
if (!enableNotifiersObserver)
return;
CFRunLoopObserverInvalidate(enableNotifiersObserver);
CFRelease(enableNotifiersObserver);
enableNotifiersObserver = 0;
}
void QCFSocketNotifier::unregisterSocketInfo(MacSocketInfo *socketInfo)
{
if (socketInfo->runloop) {
if (CFSocketIsValid(socketInfo->socket))
qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop); qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
CFRunLoopSourceInvalidate(socketInfo->runloop); CFRunLoopSourceInvalidate(socketInfo->runloop);
CFRelease(socketInfo->runloop); CFRelease(socketInfo->runloop);
}
CFSocketInvalidate(socketInfo->socket); CFSocketInvalidate(socketInfo->socket);
CFRelease(socketInfo->socket); CFRelease(socketInfo->socket);
} }
void QCFSocketNotifier::enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info)
{
Q_UNUSED(ref);
Q_UNUSED(activity);
QCFSocketNotifier *that = static_cast<QCFSocketNotifier *>(info);
foreach (MacSocketInfo *socketInfo, that->macSockets) {
if (!CFSocketIsValid(socketInfo->socket))
continue;
if (!socketInfo->runloop) {
// Add CFSocket to runloop.
if (!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
CFSocketInvalidate(socketInfo->socket);
continue;
}
if (!socketInfo->readNotifier)
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
if (!socketInfo->writeNotifier)
CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
}
if (socketInfo->readNotifier && !socketInfo->readEnabled) {
socketInfo->readEnabled = true;
CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
}
if (socketInfo->writeNotifier && !socketInfo->writeEnabled) {
socketInfo->writeEnabled = true;
CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
}
} }
} }

View File

@ -53,11 +53,14 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
struct MacSocketInfo { struct MacSocketInfo {
MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {} MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0),
readEnabled(false), writeEnabled(false) {}
CFSocketRef socket; CFSocketRef socket;
CFRunLoopSourceRef runloop; CFRunLoopSourceRef runloop;
QObject *readNotifier; QObject *readNotifier;
QObject *writeNotifier; QObject *writeNotifier;
bool readEnabled;
bool writeEnabled;
}; };
typedef QHash<int, MacSocketInfo *> MacSocketHash; typedef QHash<int, MacSocketInfo *> MacSocketHash;
@ -83,9 +86,18 @@ public:
void unregisterSocketNotifier(QSocketNotifier *notifier); void unregisterSocketNotifier(QSocketNotifier *notifier);
void removeSocketNotifiers(); void removeSocketNotifiers();
private:
void destroyRunLoopObserver();
static void unregisterSocketInfo(MacSocketInfo *socketInfo);
static void enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
MacSocketHash macSockets; MacSocketHash macSockets;
QAbstractEventDispatcher *eventDispatcher; QAbstractEventDispatcher *eventDispatcher;
MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents; MaybeCancelWaitForMoreEventsFn maybeCancelWaitForMoreEvents;
CFRunLoopObserverRef enableNotifiersObserver;
friend void qt_mac_socket_callback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *);
}; };
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -87,17 +87,9 @@ void QCocoaScreen::updateGeometry()
NSRect frameRect = [nsScreen frame]; NSRect frameRect = [nsScreen frame];
// Since Mavericks, there is a setting, System Preferences->Mission Control-> if (m_screenIndex == 0) {
// Displays have separate Spaces.
BOOL spansDisplays = NO;
#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_9)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_9)
spansDisplays = [NSScreen screensHaveSeparateSpaces];
#endif
if (spansDisplays || m_screenIndex == 0) {
m_geometry = QRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height); m_geometry = QRect(frameRect.origin.x, frameRect.origin.y, frameRect.size.width, frameRect.size.height);
// Displays have separate Spaces setting is on or this is the primary screen, // This is the primary screen, the one that contains the menubar. Its origin should be
// the one that contains the menubar. Its origin should be
// (0, 0), and it's the only one whose available geometry differs from its full geometry. // (0, 0), and it's the only one whose available geometry differs from its full geometry.
NSRect visibleRect = [nsScreen visibleFrame]; NSRect visibleRect = [nsScreen visibleFrame];
m_availableGeometry = QRect(visibleRect.origin.x, m_availableGeometry = QRect(visibleRect.origin.x,

View File

@ -75,13 +75,13 @@ public:
QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0; QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0;
} }
#ifndef QT_NO_CURSOR
void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE
{ {
Q_UNUSED(windowCursor); Q_UNUSED(windowCursor);
Q_UNUSED(window); Q_UNUSED(window);
} }
#endif
private: private:
QPoint m_pos; QPoint m_pos;
}; };

View File

@ -1325,7 +1325,7 @@ bool QMYSQLDriver::open(const QString& db,
if (writeTimeout != 0) if (writeTimeout != 0)
mysql_options(d->mysql, MYSQL_OPT_WRITE_TIMEOUT, &writeTimeout); mysql_options(d->mysql, MYSQL_OPT_WRITE_TIMEOUT, &writeTimeout);
#endif #endif
if (mysql_real_connect(d->mysql, MYSQL *mysql = mysql_real_connect(d->mysql,
host.isNull() ? static_cast<const char *>(0) host.isNull() ? static_cast<const char *>(0)
: host.toLocal8Bit().constData(), : host.toLocal8Bit().constData(),
user.isNull() ? static_cast<const char *>(0) user.isNull() ? static_cast<const char *>(0)
@ -1337,8 +1337,9 @@ bool QMYSQLDriver::open(const QString& db,
(port > -1) ? port : 0, (port > -1) ? port : 0,
unixSocket.isNull() ? static_cast<const char *>(0) unixSocket.isNull() ? static_cast<const char *>(0)
: unixSocket.toLocal8Bit().constData(), : unixSocket.toLocal8Bit().constData(),
optionFlags)) optionFlags);
{
if (mysql == d->mysql) {
if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) { if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) {
setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d)); setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d));
mysql_close(d->mysql); mysql_close(d->mysql);

View File

@ -1877,8 +1877,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded && const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded; qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0), const QSize viewportSize = qq->contentsRect().size();
viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
bool verticalWantsToShow = contentsSize.height() > viewportSize.height(); bool verticalWantsToShow = contentsSize.height() > viewportSize.height();
bool horizontalWantsToShow; bool horizontalWantsToShow;
@ -1908,8 +1907,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step)
const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded && const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded &&
qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded; qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded;
const QSize viewportSize(viewport()->width() + (qq->verticalScrollBar()->maximum() > 0 ? qq->verticalScrollBar()->width() : 0), const QSize viewportSize = qq->contentsRect().size();
viewport()->height() + (qq->horizontalScrollBar()->maximum() > 0 ? qq->horizontalScrollBar()->height() : 0));
bool horizontalWantsToShow = contentsSize.width() > viewportSize.width(); bool horizontalWantsToShow = contentsSize.width() > viewportSize.width();
bool verticalWantsToShow; bool verticalWantsToShow;

View File

@ -116,6 +116,7 @@ private slots:
void readyRead(); void readyRead();
void readyReadForEmptyDatagram(); void readyReadForEmptyDatagram();
void asyncReadDatagram(); void asyncReadDatagram();
void writeInHostLookupState();
protected slots: protected slots:
void empty_readyReadSlot(); void empty_readyReadSlot();
@ -1724,5 +1725,17 @@ void tst_QUdpSocket::asyncReadDatagram()
delete m_asyncReceiver; delete m_asyncReceiver;
} }
void tst_QUdpSocket::writeInHostLookupState()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
return;
QUdpSocket socket;
socket.connectToHost("nosuchserver.qt-project.org", 80);
QCOMPARE(socket.state(), QUdpSocket::HostLookupState);
QVERIFY(!socket.putChar('0'));
}
QTEST_MAIN(tst_QUdpSocket) QTEST_MAIN(tst_QUdpSocket)
#include "tst_qudpsocket.moc" #include "tst_qudpsocket.moc"

View File

@ -149,6 +149,7 @@ private slots:
void spacing(); void spacing();
void testScrollToWithHidden(); void testScrollToWithHidden();
void testViewOptions(); void testViewOptions();
void taskQTBUG_39902_mutualScrollBars_data();
void taskQTBUG_39902_mutualScrollBars(); void taskQTBUG_39902_mutualScrollBars();
void horizontalScrollingByVerticalWheelEvents(); void horizontalScrollingByVerticalWheelEvents();
}; };
@ -2361,8 +2362,21 @@ private:
QStyle* m_oldStyle; QStyle* m_oldStyle;
}; };
void tst_QListView::taskQTBUG_39902_mutualScrollBars_data()
{
QTest::addColumn<QAbstractItemView::ScrollMode>("horizontalScrollMode");
QTest::addColumn<QAbstractItemView::ScrollMode>("verticalScrollMode");
QTest::newRow("per item / per item") << QAbstractItemView::ScrollPerItem << QAbstractItemView::ScrollPerItem;
QTest::newRow("per pixel / per item") << QAbstractItemView::ScrollPerPixel << QAbstractItemView::ScrollPerItem;
QTest::newRow("per item / per pixel") << QAbstractItemView::ScrollPerItem << QAbstractItemView::ScrollPerPixel;
QTest::newRow("per pixel / per pixel") << QAbstractItemView::ScrollPerPixel << QAbstractItemView::ScrollPerPixel;
}
void tst_QListView::taskQTBUG_39902_mutualScrollBars() void tst_QListView::taskQTBUG_39902_mutualScrollBars()
{ {
QFETCH(QAbstractItemView::ScrollMode, horizontalScrollMode);
QFETCH(QAbstractItemView::ScrollMode, verticalScrollMode);
QWidget window; QWidget window;
window.resize(400, 300); window.resize(400, 300);
QListView *view = new QListView(&window); QListView *view = new QListView(&window);
@ -2374,6 +2388,9 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
model.setData(model.index(i, 0), itemSize, Qt::SizeHintRole); model.setData(model.index(i, 0), itemSize, Qt::SizeHintRole);
view->setModel(&model); view->setModel(&model);
view->setVerticalScrollMode(verticalScrollMode);
view->setHorizontalScrollMode(horizontalScrollMode);
window.show(); window.show();
QVERIFY(QTest::qWaitForWindowExposed(&window)); QVERIFY(QTest::qWaitForWindowExposed(&window));
// make sure QListView is done with layouting the items (1/10 sec, like QListView) // make sure QListView is done with layouting the items (1/10 sec, like QListView)
@ -2414,7 +2431,7 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
QTRY_VERIFY(view->horizontalScrollBar()->isVisible()); QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(view->verticalScrollBar()->isVisible()); QTRY_VERIFY(view->verticalScrollBar()->isVisible());
// now remove just one single pixel in with -> both scroll bars will show up since they depend on each other // now remove just one single pixel in width -> both scroll bars will show up since they depend on each other
view->resize(itemSize.width() + view->frameWidth() * 2 - 1, model.rowCount() * itemSize.height() + view->frameWidth() * 2); view->resize(itemSize.width() + view->frameWidth() * 2 - 1, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
QTRY_VERIFY(view->horizontalScrollBar()->isVisible()); QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(view->verticalScrollBar()->isVisible()); QTRY_VERIFY(view->verticalScrollBar()->isVisible());
@ -2423,6 +2440,11 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2); view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
QTRY_VERIFY(!view->horizontalScrollBar()->isVisible()); QTRY_VERIFY(!view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(!view->verticalScrollBar()->isVisible()); QTRY_VERIFY(!view->verticalScrollBar()->isVisible());
// now remove just one single pixel in height -> both scroll bars will show up since they depend on each other
view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2 - 1);
QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
QTRY_VERIFY(view->verticalScrollBar()->isVisible());
} }
void tst_QListView::horizontalScrollingByVerticalWheelEvents() void tst_QListView::horizontalScrollingByVerticalWheelEvents()