diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-26 09:40:39 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@theqtcompany.com> | 2016-05-26 13:04:32 +0200 |
commit | 2fb026d58b45f50ed7d5666de58c9184e81bbc60 (patch) | |
tree | ad1a80d7e2579899c55fce7771472a7d9176af0e | |
parent | 184b2ea4ea9c3e4ad735ff67c5a399e9613da8ab (diff) | |
parent | 540978288ea0f6ed0b166bb9207f427a4c825ab6 (diff) |
Merge remote-tracking branch 'origin/5.6.1' into 5.7.0
Conflicts:
src/corelib/tools/qsimd_p.h
src/network/socket/qnativesocketengine_winrt.cpp
Change-Id: I2765b671664c2a84839b2f88ba724fdf0c1fa7c6
-rw-r--r-- | dist/changes-5.6.1 | 165 | ||||
-rw-r--r-- | src/corelib/global/qendian.h | 24 | ||||
-rw-r--r-- | src/corelib/global/qendian.qdoc | 23 | ||||
-rw-r--r-- | src/corelib/json/qjson_p.h | 2 | ||||
-rw-r--r-- | src/corelib/mimetypes/qmimemagicrule.cpp | 3 | ||||
-rw-r--r-- | src/corelib/tools/qbitarray.cpp | 26 | ||||
-rw-r--r-- | src/corelib/tools/qhash.cpp | 9 | ||||
-rw-r--r-- | src/corelib/tools/qsimd.cpp | 22 | ||||
-rw-r--r-- | src/corelib/tools/qsimd_p.h | 26 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qbmphandler.cpp | 16 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_winrt.cpp | 5 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 12 |
13 files changed, 242 insertions, 93 deletions
diff --git a/dist/changes-5.6.1 b/dist/changes-5.6.1 new file mode 100644 index 0000000000..c256f36305 --- /dev/null +++ b/dist/changes-5.6.1 @@ -0,0 +1,165 @@ +Qt 5.6.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.6.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + + https://doc.qt.io/qt-5/ + +The Qt version 5.6 series is binary compatible with the 5.5.x series. +Applications compiled for 5.5 will continue to run with 5.6. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + https://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 * +**************************************************************************** + + - Support for DirectFB is disabled by default, due to lack of + development in upstream. To enable the platform plugin, pass the + -directfb option to configure. + - [QTBUG-44964] The new X event compression feature that was added in 5.6.0 + no longer applies to motion events from drawing tablets. + +configure & build system +------------------------ + + - The configure -D/-I/-L/-l/-R options do not affect the build of Qt's + host tools any more when cross-building. While this usually improves + the chances of a build succeeding, it may also require adjustments. + +qmake +----- + + - [Unix] Paths passed to configure -R are not automatically used by 3rd + party projects any more. Use QMAKE_RPATHDIR if your project explicitly + depends on external libraries. Note that this is not needed for Qt or + its transitive dependencies. + - Expansions of ${QMAKE_FILE_IN_BASE} and ${QMAKE_FILE_OUT_BASE} in extra + compilers are now automatically quoted. + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - QObject: + * [QTBUG-52542] If the compiler supports variadic templates, functors + connected to signals will no longer be copied each time the signal is + emitted. + + - QRect: + * Fixed integer overflow in center(). This fixes the result for some + corner-cases such as a 1x1 rectangle at (INT_MIN, INT_MIN), for which the + previous implementation could return anything (due to invoking undefined + behavior), but commonly returned (0, 0). + + - QStringRef: + * Fixed relational operators against (const char*) to return the correct + result. + +QtGui +----- + + - [QTBUG-50199] QWheelEvent::phase() now returns zero rather than + Qt::ScrollUpdate when the wheel event comes from an actual non-emulated + mouse wheel, and the QT_ENABLE_MOUSE_WHEEL_TRACKING environment variable + is set. + +- Image: + * [QTBUG-50745] Fixed possible crash in QImage::pixel() for mono or indexed + images. + +QtWidgets +--------- + + - Dialogs: + * [QTBUG-51148] Fixed font dialog support for fonts with a non-existent + family name and/or pixel size. + + - QHeaderView: + * [QTBUG-50171] Fixed a repainting issue when items had been reordered. + + - QListWidget: + * [QTBUG-15741] Fixed a bug that caused the default drop action to be + ignored when using icon mode. + + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + +Android +------- + + - The navigation bar is now hidden only on Android API level 19 and above. + +OS X +---- + - [QTBUG-50262] QStandardPaths now returns the correct display name for the + download folder. + - [QTBUG-7000] QMacPrintEngine now really sets the printer resolution. + - [QTBUG-48138] QPinchGesture on OS X now behaves like on other platforms: + totalScaleFactor is the magnitude of the pinch and scaleFactor is the delta + for the current event. + +Windows +------- + + - Text: + * [QTBUG-18711] Fixed disabling hints for application fonts. + For example, when automatic scaling by device pixel ratio is in effect. + * [QTBUG-47141] Made it possible to disable antialiasing for text when + drawing into images. + +X11/XCB +------- + + - [QTBUG-49071] Fixed failure to deliver focusIn events on hide/show. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-11545][Windows] Added missing -pch/-no-pch options to configure.exe. + - [QTBUG-37952][Apple] configure -separate-debug-info is now supported. + - [QTBUG-47313][QTBUG-47639] Fixed builds with "debug" and/or "release" in + the build path's name. + - [QTBUG-51621][Unix] Fixed transitive dependencies on non-Qt libraries. + - [QTBUG-51644][QTBUG-53017] Fixed cross-builds which use a host compiler + which is significantly different from the target compiler. + - [QTBUG-52578][QNX] Unified some defaults between the Unix and Windows + configures. + - [Unix] configure -R now supports paths relative to -libdir. + - [Android@Windows] Added missing -android-ndk-host option to configure.exe. + - [MinGW] Fixed -release -force-debug-info builds actually being neither. + - [WinCE] Fixed (Open)SSL detection. + - Fixed builds with static libc. + +qmake +----- + + - [QTBUG-34182] Fixed UTF-8 BOM breaking dependency calculation. + - [QTBUG-38802][WinRT] Capabilities needed by Qt are now automatically + added to the manifest. + - [QTBUG-50924][WEC7][VS] Fixed deployment of Qt. + - [QTBUG-51775][Unix@Windows] Fixed installation of target.targets when + cross-building. + - [QTBUG-51782] Fixed simultaneous use of the separate_debug_info and + no_plugin_name_prefix CONFIG flags. + - [QTBUG-52008] qmake-generated Visual Studio projects now automatically + invoke windeployqt by default. + - [QTBUG-52998] Restored use of -P option when invoking lex. + - The expansions ${QMAKE_FILE_IN_EXT}, ${QMAKE_FILE_IN_NAME}, and + ${QMAKE_FILE_OUT_PATH} are now understood in extra compilers. diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index c5ff82c10a..34bb015a2f 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -49,6 +49,11 @@ QT_BEGIN_NAMESPACE +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif /* * ENDIAN FUNCTIONS @@ -71,18 +76,29 @@ template <typename T> inline void qbswap(const T src, uchar *dest) // Used to implement a type-safe and alignment-safe copy operation // If you want to avoid the memcpy, you must write specializations for these functions -template <typename T> inline void qToUnaligned(const T src, uchar *dest) +template <typename T> Q_ALWAYS_INLINE void qToUnaligned(const T src, uchar *dest) { // Using sizeof(T) inside memcpy function produces internal compiler error with // MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T. const size_t size = sizeof(T); - memcpy(dest, &src, size); +#if QT_HAS_BUILTIN(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + (dest, &src, size); } -template <typename T> inline T qFromUnaligned(const uchar *src) + +template <typename T> Q_ALWAYS_INLINE T qFromUnaligned(const uchar *src) { T dest; const size_t size = sizeof(T); - memcpy(&dest, src, size); +#if QT_HAS_BUILTIN(__builtin_memcpy) + __builtin_memcpy +#else + memcpy +#endif + (&dest, src, size); return dest; } diff --git a/src/corelib/global/qendian.qdoc b/src/corelib/global/qendian.qdoc index 63d924211f..3b22dcec87 100644 --- a/src/corelib/global/qendian.qdoc +++ b/src/corelib/global/qendian.qdoc @@ -34,6 +34,29 @@ */ /*! + \internal + \fn T qFromUnaligned(const uchar *ptr) + \since 5.5 + + Loads a \c{T} from address \a ptr, which may be misaligned. + + Use of this function avoids the undefined behavior that the C++ standard + otherwise attributes to unaligned loads. +*/ + +/*! + \internal + \fn void qToUnaligned(T t, uchar *ptr) + \since 4.5 + + Stores \a t to address \a ptr, which may be misaligned. + + Use of this function avoids the undefined behavior that the C++ standard + otherwise attributes to unaligned stores. +*/ + + +/*! \fn T qFromBigEndian(const uchar *src) \since 4.3 \relates <QtEndian> diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 5e34845fe3..f92a6821d7 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -410,7 +410,7 @@ public: // pack with itself, we'll discard the high part anyway chunk = _mm_packus_epi16(chunk, chunk); // unaligned 64-bit store - qUnalignedStore(l + i, _mm_cvtsi128_si64(chunk)); + qToUnaligned(_mm_cvtsi128_si64(chunk), l + i); i += 8; } # endif diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp index 0db3407b7b..8461bf7130 100644 --- a/src/corelib/mimetypes/qmimemagicrule.cpp +++ b/src/corelib/mimetypes/qmimemagicrule.cpp @@ -48,7 +48,6 @@ #include <QtCore/QList> #include <QtCore/QDebug> #include <qendian.h> -#include <private/qsimd_p.h> // for qUnalignedLoad QT_BEGIN_NAMESPACE @@ -164,7 +163,7 @@ bool QMimeMagicRule::matchNumber(const QByteArray &data) const const char *p = data.constData() + m_startPos; const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), m_endPos + 1); for ( ; p <= e; ++p) { - if ((qUnalignedLoad<T>(p) & mask) == (value & mask)) + if ((qFromUnaligned<T>(reinterpret_cast<const uchar *>(p)) & mask) == (value & mask)) return true; } diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 446e09b1c0..12e4687b3c 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -42,6 +42,7 @@ #include <qalgorithms.h> #include <qdatastream.h> #include <qdebug.h> +#include <qendian.h> #include <string.h> QT_BEGIN_NAMESPACE @@ -169,25 +170,6 @@ QBitArray::QBitArray(int size, bool value) Same as size(). */ -template <typename T> T qUnalignedLoad(const uchar *ptr) -{ - /* - * Testing with different compilers shows that they all optimize the memcpy - * call away and replace with direct loads whenever possible. On x86 and PPC, - * GCC does direct unaligned loads; on MIPS, it generates a pair of load-left - * and load-right instructions. ICC and Clang do the same on x86. This is both - * 32- and 64-bit. - * - * On ARM cores without unaligned loads, the compiler leaves a call to - * memcpy. - */ - - T u; - memcpy(&u, ptr, sizeof(u)); - return u; -} - - /*! If \a on is true, this function returns the number of 1-bits stored in the bit array; otherwise the number @@ -203,17 +185,17 @@ int QBitArray::count(bool on) const const quint8 *const end = reinterpret_cast<const quint8 *>(d.end()); while (bits + 7 <= end) { - quint64 v = qUnalignedLoad<quint64>(bits); + quint64 v = qFromUnaligned<quint64>(bits); bits += 8; numBits += int(qPopulationCount(v)); } if (bits + 3 <= end) { - quint32 v = qUnalignedLoad<quint32>(bits); + quint32 v = qFromUnaligned<quint32>(bits); bits += 4; numBits += int(qPopulationCount(v)); } if (bits + 1 < end) { - quint16 v = qUnalignedLoad<quint16>(bits); + quint16 v = qFromUnaligned<quint16>(bits); bits += 2; numBits += int(qPopulationCount(v)); } diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 2f0886edce..593a87e65d 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -58,6 +58,7 @@ #include <qbytearray.h> #include <qdatetime.h> #include <qbasicatomic.h> +#include <qendian.h> #include <private/qsimd_p.h> #ifndef QT_BOOTSTRAPPED @@ -112,24 +113,24 @@ static uint crc32(const Char *ptr, size_t len, uint h) p += 8; for ( ; p <= e; p += 8) - h2 = _mm_crc32_u64(h2, qUnalignedLoad<qlonglong>(p - 8)); + h2 = _mm_crc32_u64(h2, qFromUnaligned<qlonglong>(p - 8)); h = h2; p -= 8; len = e - p; if (len & 4) { - h = _mm_crc32_u32(h, qUnalignedLoad<uint>(p)); + h = _mm_crc32_u32(h, qFromUnaligned<uint>(p)); p += 4; } # else p += 4; for ( ; p <= e; p += 4) - h = _mm_crc32_u32(h, qUnalignedLoad<uint>(p - 4)); + h = _mm_crc32_u32(h, qFromUnaligned<uint>(p - 4)); p -= 4; len = e - p; # endif if (len & 2) { - h = _mm_crc32_u16(h, qUnalignedLoad<ushort>(p)); + h = _mm_crc32_u16(h, qFromUnaligned<ushort>(p)); p += 2; } if (sizeof(Char) == 1 && len & 1) diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 3a5f0f18a1..c869c4e089 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -751,26 +751,4 @@ void qDumpCPUFeatures() puts(""); } -/*! - \internal - \fn T qUnalignedLoad(const void *ptr) - \since 5.6.1 - - Loads a \c{T} from address \a ptr, which may be misaligned. - - Use of this function avoid the undefined behavior that the C++ standard - otherwise attributes to unaligned loads. -*/ - -/*! - \internal - \fn void qUnalignedStore(void *ptr, T t) - \since 5.6.1 - - Stores \a t to address \a ptr, which may be misaligned. - - Use of this function avoid the undefined behavior that the C++ standard - otherwise attributes to unaligned stores. -*/ - QT_END_NAMESPACE diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index f68ae5d3b8..7002d34654 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -527,32 +527,6 @@ unsigned _bit_scan_forward(unsigned val) #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) -template <typename T> -Q_ALWAYS_INLINE -T qUnalignedLoad(const void *ptr) Q_DECL_NOTHROW -{ - T result; -#if QT_HAS_BUILTIN(__builtin_memcpy) - __builtin_memcpy -#else - memcpy -#endif - /*memcpy*/(&result, ptr, sizeof result); - return result; -} - -template <typename T> -Q_ALWAYS_INLINE -void qUnalignedStore(void *ptr, T t) Q_DECL_NOTHROW -{ -#if QT_HAS_BUILTIN(__builtin_memcpy) - __builtin_memcpy -#else - memcpy -#endif - /*memcpy*/(ptr, &t, sizeof t); -} - QT_END_NAMESPACE #endif // QSIMD_P_H diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 9f968978dc..940fd5817b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -584,7 +584,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l) // we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes) if (uc + offset + 7 < e) { // same, but we're using an 8-byte load - __m128i chunk = _mm_cvtsi64_si128(qUnalignedLoad<long long>(c + offset)); + __m128i chunk = _mm_cvtsi64_si128(qFromUnaligned<long long>(c + offset)); __m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask); __m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset)); diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index b8290861af..9545abfd21 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -289,6 +289,12 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int format = QImage::Format_Mono; } + if (depth != 32) { + ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits; + if (ncols < 1 || ncols > 256) // sanity check - don't run out of mem if color table is broken + return false; + } + if (bi.biHeight < 0) h = -h; // support images with negative height @@ -296,19 +302,15 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int image = QImage(w, h, format); if (image.isNull()) // could not create image return false; - } - - if (depth != 32) { - ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits; - if (ncols < 1 || ncols > 256) // sanity check - don't run out of mem if color table is broken - return false; - image.setColorCount(ncols); + if (ncols) + image.setColorCount(ncols); // Ensure valid QImage } image.setDotsPerMeterX(bi.biXPelsPerMeter); image.setDotsPerMeterY(bi.biYPelsPerMeter); if (ncols > 0) { // read color table + image.setColorCount(ncols); uchar rgb[4]; int rgb_len = t == BMP_OLD ? 3 : 4; for (int i=0; i<ncols; i++) { diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp index 181c49f200..2a6f9ad7f1 100644 --- a/src/network/socket/qnativesocketengine_winrt.cpp +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -477,7 +477,10 @@ void QNativeSocketEngine::close() hr = socket3->CancelIOAsync(&action); Q_ASSERT_SUCCEEDED(hr); hr = QWinRTFunctions::await(action); - Q_ASSERT_SUCCEEDED(hr); + // If there is no pending IO (no read established before) the function will fail with + // "function was called at an unexpected time" which is fine. + if (hr != E_ILLEGAL_METHOD_CALL) + Q_ASSERT_SUCCEEDED(hr); return S_OK; }); Q_ASSERT_SUCCEEDED(hr); diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 5972cf9504..a32e5817e0 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -663,7 +663,9 @@ QT_WARNING_POP - (BOOL)becomeFirstResponder { - if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) + if (!m_window || !m_platformWindow) + return NO; + if (m_window->flags() & Qt::WindowTransparentForInput) return NO; if (!m_platformWindow->windowIsPopupType() && !m_isMenuView) QWindowSystemInterface::handleWindowActivated([self topLevelWindow]); @@ -672,11 +674,13 @@ QT_WARNING_POP - (BOOL)acceptsFirstResponder { + if (!m_window || !m_platformWindow) + return NO; if (m_isMenuView) return NO; if (m_platformWindow->shouldRefuseKeyWindowAndFirstResponder()) return NO; - if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) + if (m_window->flags() & Qt::WindowTransparentForInput) return NO; if ((m_window->flags() & Qt::ToolTip) == Qt::ToolTip) return NO; @@ -686,7 +690,9 @@ QT_WARNING_POP - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { Q_UNUSED(theEvent) - if (m_window && (m_window->flags() & Qt::WindowTransparentForInput) ) + if (!m_window || !m_platformWindow) + return NO; + if (m_window->flags() & Qt::WindowTransparentForInput) return NO; return YES; } |