summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CTestMacros.cmake8
-rw-r--r--src/corelib/Qt5CoreMacros.cmake12
-rw-r--r--src/corelib/global/qcompilerdetection.h2
-rw-r--r--src/corelib/global/qglobal.cpp2
-rw-r--r--src/corelib/global/qnamespace.qdoc8
-rw-r--r--src/corelib/global/qsystemdetection.h25
-rw-r--r--src/corelib/io/qprocess.cpp6
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp2
-rw-r--r--src/corelib/json/qjsonvalue.cpp8
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp8
-rw-r--r--src/corelib/kernel/qmetaobject.h2
-rw-r--r--src/corelib/kernel/qobject.cpp34
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern.cpp8
-rw-r--r--src/corelib/tools/qbytearray.cpp6
-rw-r--r--src/corelib/tools/qbytearray.h2
-rw-r--r--src/corelib/tools/qhash.cpp2
-rw-r--r--src/corelib/tools/qlist.h20
-rw-r--r--src/corelib/tools/qlocale_mac.mm2
-rw-r--r--src/corelib/tools/qlocale_tools.cpp5
20 files changed, 109 insertions, 55 deletions
diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake
index 71097aadbf..cea514ff52 100644
--- a/src/corelib/Qt5CTestMacros.cmake
+++ b/src/corelib/Qt5CTestMacros.cmake
@@ -19,6 +19,14 @@ endforeach()
set(BUILD_OPTIONS_LIST)
+if (CMAKE_C_COMPILER)
+ list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
+endif()
+
+if (CMAKE_CXX_COMPILER)
+ list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}")
+endif()
+
if (CMAKE_BUILD_TYPE)
list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
endif()
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index f549fead59..6630885257 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -219,6 +219,18 @@ set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
if (NOT CMAKE_VERSION VERSION_LESS 2.8.9)
macro(qt5_use_modules _target _link_type)
+ if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.11)
+ if(CMAKE_WARN_DEPRECATED)
+ set(messageType WARNING)
+ endif()
+ if(CMAKE_ERROR_DEPRECATED)
+ set(messageType FATAL_ERROR)
+ endif()
+ if(messageType)
+ message(${messageType} "The qt5_use_modules macro is obsolete. Use target_link_libraries with IMPORTED targets instead.")
+ endif()
+ endif()
+
if (NOT TARGET ${_target})
message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.")
endif()
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 27fc2d4038..41e11ea652 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -584,7 +584,7 @@
# if __has_feature(cxx_alias_templates)
# define Q_COMPILER_TEMPLATE_ALIAS
# endif
-# if 0 /* not implemented in clang yet */
+# if __has_feature(cxx_thread_local)
# define Q_COMPILER_THREAD_LOCAL
# endif
# if __has_feature(cxx_user_literals)
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index ac347655bc..4ee4235278 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2324,7 +2324,7 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
*/
void qsrand(uint seed)
{
-#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 4a5285fa5d..d8d7b9cbcd 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1211,12 +1211,8 @@
/*! \typedef Qt::HANDLE
- Platform-specific handle type for system objects. This is
- equivalent to \c{void *} on Mac OS X and embedded Linux,
- and to \c{unsigned long} on X11. On Windows it is the
- DWORD returned by the Win32 function getCurrentThreadId().
-
- \warning Using this type is not portable.
+ A handle type for system objects, defined as \c{void *}
+ on all platforms.
*/
/*!
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 5e68226b60..dc9fa7383a 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -62,8 +62,8 @@
SOLARIS - Sun Solaris
HPUX - HP-UX
ULTRIX - DEC Ultrix
- LINUX - Linux
- FREEBSD - FreeBSD
+ LINUX - Linux [has variants]
+ FREEBSD - FreeBSD [has variants]
NETBSD - NetBSD
OPENBSD - OpenBSD
BSDI - BSD/OS
@@ -76,12 +76,20 @@
DGUX - DG/UX
RELIANT - Reliant UNIX
DYNIX - DYNIX/ptx
- QNX - QNX
+ QNX - QNX [has variants]
QNX6 - QNX RTP 6.1
LYNX - LynxOS
BSD4 - Any BSD 4.4 system
UNIX - Any UNIX BSD/SYSV system
ANDROID - Android platform
+
+ The following operating systems have variants:
+ LINUX - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android
+ - only Q_OS_LINUX is defined if building for other Linux systems
+ QNX - both Q_OS_QNX and Q_OS_BLACKBERRY are defined when building for Blackberry 10
+ - only Q_OS_QNX is defined if building for other QNX targets
+ FREEBSD - Q_OS_FREEBSD is defined only when building for FreeBSD with a BSD userland
+ - Q_OS_FREEBSD_KERNEL is always defined on FreeBSD, even if the userland is from GNU
*/
#if defined(__APPLE__) && (defined(__GNUC__) || defined(__xlC__) || defined(__xlc__))
@@ -118,8 +126,11 @@
# define Q_OS_NACL
#elif defined(__linux__) || defined(__linux)
# define Q_OS_LINUX
-#elif defined(__FreeBSD__) || defined(__DragonFly__)
-# define Q_OS_FREEBSD
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
+# ifndef __FreeBSD_kernel__
+# define Q_OS_FREEBSD
+# endif
+# define Q_OS_FREEBSD_KERNEL
# define Q_OS_BSD4
#elif defined(__NetBSD__)
# define Q_OS_NETBSD
@@ -239,10 +250,6 @@
# if !defined(__IPHONE_7_0)
# define __IPHONE_7_0 70000
# endif
-#
-# if (__MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_8)
-# warning "This version of OS X is unsupported"
-# endif
#endif
#ifdef __LSB_VERSION__
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 1be108d0a7..96cec568df 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1691,10 +1691,10 @@ QProcessEnvironment QProcess::processEnvironment() const
bool QProcess::waitForStarted(int msecs)
{
Q_D(QProcess);
- if (d->processState == QProcess::Running)
- return true;
+ if (d->processState == QProcess::Starting)
+ return d->waitForStarted(msecs);
- return d->waitForStarted(msecs);
+ return d->processState == QProcess::Running;
}
/*! \reimp
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index a4d73ea480..ea4d9b44c3 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -622,6 +622,8 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *model)
q, SLOT(_q_layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
QObject::connect(model, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
q, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
+ QObject::connect(model, SIGNAL(modelReset()),
+ q, SLOT(reset()));
}
}
diff --git a/src/corelib/json/qjsonvalue.cpp b/src/corelib/json/qjsonvalue.cpp
index d0b06c6924..3aba6124b8 100644
--- a/src/corelib/json/qjsonvalue.cpp
+++ b/src/corelib/json/qjsonvalue.cpp
@@ -396,9 +396,13 @@ QVariant QJsonValue::toVariant() const
case String:
return toString();
case Array:
- return QJsonArray(d, static_cast<QJsonPrivate::Array *>(base)).toVariantList();
+ return d ?
+ QJsonArray(d, static_cast<QJsonPrivate::Array *>(base)).toVariantList() :
+ QVariantList();
case Object:
- return QJsonObject(d, static_cast<QJsonPrivate::Object *>(base)).toVariantMap();
+ return d ?
+ QJsonObject(d, static_cast<QJsonPrivate::Object *>(base)).toVariantMap() :
+ QVariantMap();
case Null:
case Undefined:
break;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 4a46bb32f5..3460b9e228 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1972,7 +1972,7 @@ QString QCoreApplication::applicationFilePath()
}
#endif
#if defined( Q_OS_UNIX )
-# ifdef Q_OS_LINUX
+# if defined(Q_OS_LINUX) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK))
// Try looking for a /proc/<pid>/exe symlink first which points to
// the absolute path of the executable
QFileInfo pfi(QString::fromLatin1("/proc/%1/exe").arg(getpid()));
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 7211a730ec..4dc766ecc5 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1589,6 +1589,14 @@ bool QMetaObject::invokeMethod(QObject *obj,
\internal
*/
+/*!
+ \macro Q_METAMETHOD_INVOKE_MAX_ARGS
+ \relates QMetaMethod
+
+ Equals maximum number of arguments available for
+ execution of the method via QMetaMethod::invoke()
+ */
+
QByteArray QMetaMethodPrivate::signature() const
{
Q_ASSERT(priv(mobj->d.data)->revision >= 7);
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 23fc89ffe3..0c8ad8591f 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
template <typename T> class QList;
+#define Q_METAMETHOD_INVOKE_MAX_ARGS 10
+
class Q_CORE_EXPORT QMetaMethod
{
public:
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 997a65169d..f99bcf1532 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -816,6 +816,14 @@ QObject::~QObject()
m->unlock();
connectionList.first = c->nextConnectionList;
+
+ // The destroy operation must happen outside the lock
+ if (c->isSlotObject) {
+ locker.unlock();
+ c->slotObj->destroyIfLastRef();
+ c->isSlotObject = false;
+ locker.relock();
+ }
c->deref();
}
}
@@ -3135,6 +3143,13 @@ bool QMetaObjectPrivate::disconnectHelper(QObjectPrivate::Connection *c,
c->receiver = 0;
+ if (c->isSlotObject) {
+ senderMutex->unlock();
+ c->slotObj->destroyIfLastRef();
+ c->isSlotObject = false;
+ senderMutex->lock();
+ }
+
success = true;
if (disconnectType == DisconnectOne)
@@ -4385,16 +4400,19 @@ bool QObject::disconnect(const QMetaObject::Connection &connection)
QMutex *senderMutex = signalSlotLock(c->sender);
QMutex *receiverMutex = signalSlotLock(c->receiver);
- QOrderedMutexLocker locker(senderMutex, receiverMutex);
- QObjectConnectionListVector *connectionLists = QObjectPrivate::get(c->sender)->connectionLists;
- Q_ASSERT(connectionLists);
- connectionLists->dirty = true;
+ {
+ QOrderedMutexLocker locker(senderMutex, receiverMutex);
- *c->prev = c->next;
- if (c->next)
- c->next->prev = c->prev;
- c->receiver = 0;
+ QObjectConnectionListVector *connectionLists = QObjectPrivate::get(c->sender)->connectionLists;
+ Q_ASSERT(connectionLists);
+ connectionLists->dirty = true;
+
+ *c->prev = c->next;
+ if (c->next)
+ c->next->prev = c->prev;
+ c->receiver = 0;
+ }
// destroy the QSlotObject, if possible
if (c->isSlotObject) {
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp
index 96798cabcd..530d3de4a2 100644
--- a/src/corelib/mimetypes/qmimeglobpattern.cpp
+++ b/src/corelib/mimetypes/qmimeglobpattern.cpp
@@ -77,9 +77,11 @@ void QMimeGlobMatchResult::addMatch(const QString &mimeType, int weight, const Q
m_matchingPatternLength = pattern.length();
m_weight = weight;
}
- m_matchingMimeTypes.append(mimeType);
- if (pattern.startsWith(QLatin1String("*.")))
- m_foundSuffix = pattern.mid(2);
+ if (!m_matchingMimeTypes.contains(mimeType)) {
+ m_matchingMimeTypes.append(mimeType);
+ if (pattern.startsWith(QLatin1String("*.")))
+ m_foundSuffix = pattern.mid(2);
+ }
}
/*!
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 188deb4f94..a2d3891f00 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -586,7 +586,7 @@ QByteArray qUncompress(const uchar* data, int nbytes)
d->data()[len] = 0;
{
- QByteArrayDataPtr dataPtr = { reinterpret_cast<QByteArrayData *>(d.take()) };
+ QByteArrayDataPtr dataPtr = { d.take() };
return QByteArray(dataPtr);
}
@@ -3152,7 +3152,7 @@ QByteArray QByteArray::trimmed() const
}
int l = end - start + 1;
if (l <= 0) {
- QByteArrayDataPtr empty = { reinterpret_cast<QByteArrayData *>(Data::allocate(0)) };
+ QByteArrayDataPtr empty = { Data::allocate(0) };
return QByteArray(empty);
}
return QByteArray(s+start, l);
@@ -3889,7 +3889,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size)
x = Data::fromRawData(data, size);
Q_CHECK_PTR(x);
}
- QByteArrayDataPtr dataPtr = { reinterpret_cast<QByteArrayData *>(x) };
+ QByteArrayDataPtr dataPtr = { x };
return QByteArray(dataPtr);
}
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index f3cc301a49..85d1f0ab90 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -373,7 +373,7 @@ public:
bool isNull() const;
inline QByteArray(QByteArrayDataPtr dd)
- : d(reinterpret_cast<Data *>(dd.ptr))
+ : d(static_cast<Data *>(dd.ptr))
{
}
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 59e7a979dc..4b9d120bb3 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -1226,7 +1226,7 @@ void QHashData::checkSanity()
/*! \fn QList<T> QHash::values() const
Returns a list containing all the values in the hash, in an
- arbitrary order. If a key is associated multiple values, all of
+ arbitrary order. If a key is associated with multiple values, all of
its values will be in the list, and not just the most recently
inserted one.
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 8a9d364eac..28d35745a5 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -725,18 +725,14 @@ Q_OUTOFLINE_TEMPLATE QList<T>::QList(const QList<T> &l)
if (!d->ref.ref()) {
p.detach(d->alloc);
- struct Cleanup
- {
- Cleanup(QListData::Data *d) : d_(d) {}
- ~Cleanup() { if (d_) QListData::dispose(d_); }
-
- QListData::Data *d_;
- } tryCatch(d);
-
- node_copy(reinterpret_cast<Node *>(p.begin()),
- reinterpret_cast<Node *>(p.end()),
- reinterpret_cast<Node *>(l.p.begin()));
- tryCatch.d_ = 0;
+ QT_TRY {
+ node_copy(reinterpret_cast<Node *>(p.begin()),
+ reinterpret_cast<Node *>(p.end()),
+ reinterpret_cast<Node *>(l.p.begin()));
+ } QT_CATCH(...) {
+ QListData::dispose(d);
+ QT_RETHROW;
+ }
}
}
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm
index f399b7689d..43a0d67e74 100644
--- a/src/corelib/tools/qlocale_mac.mm
+++ b/src/corelib/tools/qlocale_mac.mm
@@ -434,7 +434,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case CurrencyToString:
return macFormatCurrency(in.value<QSystemLocale::CurrencyToStringArgument>());
case UILanguages: {
- QCFType<CFPropertyListRef> languages = (CFArrayRef)CFPreferencesCopyValue(
+ QCFType<CFPropertyListRef> languages = CFPreferencesCopyValue(
CFSTR("AppleLanguages"),
kCFPreferencesAnyApplication,
kCFPreferencesCurrentUser,
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp
index 6b716b356f..e695ac0f4d 100644
--- a/src/corelib/tools/qlocale_tools.cpp
+++ b/src/corelib/tools/qlocale_tools.cpp
@@ -2370,10 +2370,9 @@ static char *_qdtoa( NEEDS_VOLATILE double d, int mode, int ndigits, int *decpt,
}
b = d2b(d, &be, &bbits);
-#ifdef Sudden_Underflow
i = (int)(getWord0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
-#else
- if ((i = int(getWord0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) != 0) {
+#ifndef Sudden_Underflow
+ if (i != 0) {
#endif
d2 = d;
setWord0(&d2, getWord0(d2) & Frac_mask1);