diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-01 01:01:28 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-01 01:01:28 +0100 |
commit | f09fc1f35294827245e74ced48274387d5ed346f (patch) | |
tree | 4c07e40a13fd5be82f2afe4a38165b46dd385d34 /src/corelib | |
parent | cc9645f11b46aaad36658d62d38a5e44a5ba5ae5 (diff) | |
parent | f5c0a19077989b5ac14071ecd095e29f62d05602 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I6f8d3abd3247dc980dc7834801a017a89c8f4286
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qendian.h | 26 | ||||
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_win.cpp | 17 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 34 | ||||
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qcontiguouscache.h | 1 |
6 files changed, 69 insertions, 17 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 1cc8a823d9..0e67a1ab8e 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -41,6 +41,7 @@ #ifndef QENDIAN_H #define QENDIAN_H +#include <QtCore/qfloat16.h> #include <QtCore/qglobal.h> // include stdlib.h and hope that it defines __GLIBC__ for glibc-based systems @@ -151,6 +152,31 @@ template <> inline Q_DECL_CONSTEXPR qint8 qbswap<qint8>(qint8 source) return source; } +// floating specializations +template<typename Float> +Float qbswapFloatHelper(Float source) +{ + // memcpy call in qFromUnaligned is recognized by optimizer as a correct way of type prunning + auto temp = qFromUnaligned<typename QIntegerForSizeof<Float>::Unsigned>(&source); + temp = qbswap(temp); + return qFromUnaligned<Float>(&temp); +} + +template <> inline qfloat16 qbswap<qfloat16>(qfloat16 source) +{ + return qbswapFloatHelper(source); +} + +template <> inline float qbswap<float>(float source) +{ + return qbswapFloatHelper(source); +} + +template <> inline double qbswap<double>(double source) +{ + return qbswapFloatHelper(source); +} + /* * qbswap(const T src, const void *dest); * Changes the byte order of \a src from big endian to little endian or vice versa diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 5dd5f8031e..86e21f0a66 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -333,7 +333,7 @@ QIODevicePrivate::~QIODevicePrivate() allowed. This flag currently only affects QFile. Other classes might use this flag in the future, but until then using this flag with any classes other than QFile may - result in undefined behavior. + result in undefined behavior. (since Qt 5.11) \value ExistingOnly Fail if the file to be opened does not exist. This flag must be specified alongside ReadOnly, WriteOnly, or ReadWrite. Note that using this flag with ReadOnly alone @@ -341,7 +341,7 @@ QIODevicePrivate::~QIODevicePrivate() not exist. This flag currently only affects QFile. Other classes might use this flag in the future, but until then using this flag with any classes other than QFile may - result in undefined behavior. + result in undefined behavior. (since Qt 5.11) Certain flags, such as \c Unbuffered and \c Truncate, are meaningless when used with some subclasses. Some of these diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 0109e2c658..0c57ad34b9 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -417,6 +417,23 @@ static const char *findWMstr(uint msg) { 0x0232, "WM_EXITSIZEMOVE" }, { 0x0233, "WM_DROPFILES" }, { 0x0234, "WM_MDIREFRESHMENU" }, + { 0x0241, "WM_NCPOINTERUPDATE"}, + { 0x0242, "WM_NCPOINTERDOWN"}, + { 0x0243, "WM_NCPOINTERUP"}, + { 0x0245, "WM_POINTERUPDATE"}, + { 0x0246, "WM_POINTERDOWN"}, + { 0x0247, "WM_POINTERUP"}, + { 0x0249, "WM_POINTERENTER"}, + { 0x024A, "WM_POINTERLEAVE"}, + { 0x0248, "WM_POINTERACTIVATE"}, + { 0x024C, "WM_POINTERCAPTURECHANGED"}, + { 0x024D, "WM_TOUCHHITTESTING"}, + { 0x024E, "WM_POINTERWHEEL"}, + { 0x024F, "WM_POINTERHWHEEL"}, + { 0x0250, "DM_POINTERHITTEST"}, + { 0x0251, "WM_POINTERROUTEDTO"}, + { 0x0252, "WM_POINTERROUTEDAWAY"}, + { 0x0253, "WM_POINTERROUTEDRELEASED"}, { 0x0281, "WM_IME_SETCONTEXT" }, { 0x0282, "WM_IME_NOTIFY" }, { 0x0283, "WM_IME_CONTROL" }, diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 9aea4dec67..8dbccfec3d 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -421,6 +421,7 @@ void QObjectPrivate::cleanConnectionLists() { if (connectionLists->dirty && !connectionLists->inUse) { // remove broken connections + bool allConnected = false; for (int signal = -1; signal < connectionLists->count(); ++signal) { QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal]; @@ -432,11 +433,13 @@ void QObjectPrivate::cleanConnectionLists() QObjectPrivate::Connection **prev = &connectionList.first; QObjectPrivate::Connection *c = *prev; + bool connected = false; // whether the signal is still connected somewhere while (c) { if (c->receiver) { last = c; prev = &c->nextConnectionList; c = *prev; + connected = true; } else { QObjectPrivate::Connection *next = c->nextConnectionList; *prev = next; @@ -448,6 +451,14 @@ void QObjectPrivate::cleanConnectionLists() // Correct the connection list's last pointer. // As conectionList.last could equal last, this could be a noop connectionList.last = last; + + if (!allConnected && !connected && signal >= 0 + && size_t(signal) < sizeof(connectedSignals) * 8) { + // This signal is no longer connected + connectedSignals[signal >> 5] &= ~(1 << (signal & 0x1f)); + } else if (signal == -1) { + allConnected = connected; + } } connectionLists->dirty = false; } @@ -2502,19 +2513,20 @@ bool QObject::isSignalConnected(const QMetaMethod &signal) const signalIndex += QMetaObjectPrivate::signalOffset(signal.mobj); - if (signalIndex < sizeof(d->connectedSignals) * 8) + QMutexLocker locker(signalSlotLock(this)); + if (!d->connectionLists) + return false; + + if (signalIndex < sizeof(d->connectedSignals) * 8 && !d->connectionLists->dirty) return d->isSignalConnected(signalIndex); - QMutexLocker locker(signalSlotLock(this)); - if (d->connectionLists) { - if (signalIndex < uint(d->connectionLists->count())) { - const QObjectPrivate::Connection *c = - d->connectionLists->at(signalIndex).first; - while (c) { - if (c->receiver) - return true; - c = c->nextConnectionList; - } + if (signalIndex < uint(d->connectionLists->count())) { + const QObjectPrivate::Connection *c = + d->connectionLists->at(signalIndex).first; + while (c) { + if (c->receiver) + return true; + c = c->nextConnectionList; } } return false; diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index e04d27d7b6..e56fe2c6ae 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -465,11 +465,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW void QThread::yieldCurrentThread() { -#if !defined(Q_OS_WINRT) SwitchToThread(); -#else - ::Sleep(0); -#endif } #endif // QT_CONFIG(thread) diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index faa7263d6b..fdb9c6d19a 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -217,6 +217,7 @@ void QContiguousCache<T>::setCapacity(int asize) detach(); union { QContiguousCacheData *d; QContiguousCacheTypedData<T> *p; } x; x.d = allocateData(asize); + x.d->ref.store(1); x.d->alloc = asize; x.d->count = qMin(d->count, asize); x.d->offset = d->offset + d->count - x.d->count; |