summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-09-21 10:06:18 +0200
committerThiago Macieira <thiago.macieira@nokia.com>2010-09-21 10:06:18 +0200
commita4d1be727573a7a87c523a2ef28074c77d16f165 (patch)
treed4f8f218c41771ca17c7ab324390485af868fa8e /src/corelib
parentcd2fd21578a80bc5ac121c0419ee00b1799d0a60 (diff)
parent660ec910ef60513b511e2292255e53701dbb239b (diff)
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/corelib/kernel/qobject.h src/declarative/graphicsitems/qdeclarativeflickable.cpp src/declarative/graphicsitems/qdeclarativeflickable_p_p.h src/declarative/util/qdeclarativelistmodel.cpp
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/qtextcodec_symbian.cpp19
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/global/qnumeric.cpp35
-rw-r--r--src/corelib/io/qdir.cpp5
-rw-r--r--src/corelib/io/qsettings_win.cpp24
-rw-r--r--src/corelib/io/qurl.cpp25
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp3
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp22
-rw-r--r--src/corelib/kernel/qmath.qdoc155
-rw-r--r--src/corelib/kernel/qmetatype.h26
-rw-r--r--src/corelib/kernel/qobject.h2
-rw-r--r--src/corelib/kernel/qpointer.cpp2
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp8
-rw-r--r--src/corelib/plugin/qfactoryloader_p.h4
-rw-r--r--src/corelib/plugin/qsystemlibrary.cpp4
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp3
-rw-r--r--src/corelib/thread/qatomic.cpp12
-rw-r--r--src/corelib/thread/qthread_unix.cpp35
-rw-r--r--src/corelib/tools/qcryptographichash.cpp2
-rw-r--r--src/corelib/tools/qstring.cpp6
20 files changed, 332 insertions, 61 deletions
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp
index 20e0cfc4bd..9d7e85681f 100644
--- a/src/corelib/codecs/qtextcodec_symbian.cpp
+++ b/src/corelib/codecs/qtextcodec_symbian.cpp
@@ -59,8 +59,8 @@ struct QSymbianCodecInitData {
It is ordered by charsetId to allow binary search lookup
*/
static const QSymbianCodecInitData codecsData[] = {
- { /*268439485*/ KCharacterSetIdentifierShiftJis, 17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0MS_KANJI\0SJIS\0" },
- { /*268439486*/ KCharacterSetIdentifierGb2312, 57, "GB2312\0csGB2312\0CN-GB\0EUC-CN\0" },
+ { /*268439485*/ KCharacterSetIdentifierShiftJis, 17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0SJIS\0" },
+ { /*268439486*/ KCharacterSetIdentifierGb2312, 57, "GB2312\0csGB2312\0CN-GB\0EUC-CN\0" }, // Note: ConvertCharacterSetIdentifierToMibEnumL returns Mib 0 instaead of 57
{ /*268439487*/ KCharacterSetIdentifierBig5, 2026, "Big5\0csBig5\0Big5-ETen\0CP950\0BIG-FIVE\0CN-BIG5\0" },
{ /*268440246*/ KCharacterSetIdentifierCodePage1252, 2252, "windows-1252\0Code Page 1252\0CP1252\0MS-ANSI\0" },
// { /*268450576*/ KCharacterSetIdentifierIso88591, 4, "ISO-8859-1\0ISO_8859-1:1987\0iso-ir-100\0ISO_8859-1\0latin1\0l1\0IBM819\0CP819\0csISOLatin1\0ISO-IR-100\0ISO8859-1\0L1\0LATIN1\0CSISOLATIN1\0" },
@@ -110,15 +110,20 @@ static const QSymbianCodecInitData codecsData[] = {
{ /*270562232*/ 270562232, 2258, "Windows-1258\0CP1258\0WINDOWS-1258\0" },
{ /*270586888*/ 270586888, 0, "J5\0" },
{ /*271011982*/ 271011982, 0, "ISCII\0" },
- { /*271066541*/ 271066541, 2009, "CP850\0IBM850\0""850\0csPC850Multilingual\0" },
+ { /*271066541*/ 271066541, 2009, "CP850\0IBM850\0""850\0csPC850Multilingual\0" }, // Note: ConvertCharacterSetIdentifierToMibEnumL returns Mib 0 instead of 2009
{ /*271082493*/ 271082493, 0, "EXTENDED_SMS_7BIT\0" },
{ /*271082494*/ 271082494, 0, "gsm7_turkish_single\0" },
{ /*271082495*/ 271082495, 0, "turkish_locking_gsm7ext\0" },
{ /*271082496*/ 271082496, 0, "turkish_locking_single\0" },
+ { /*271082503*/ 271082503, 0, "portuguese_gsm7_single\0" },
+ { /*271082504*/ 271082504, 0, "portuguese_locking_gsm7ext\0" },
+ { /*271082505*/ 271082505, 0, "portuguese_locking_single\0" },
+ { /*271082506*/ 271082506, 0, "spanish_gsm7_single\0" },
+ { /*271085624*/ 271085624, 114, "GB18030\0" },
{ /*536929574*/ 536929574, 38, "EUC-KR\0" },
{ /*536936703*/ 536936703, 0, "CP949\0" },
- { /*536936705*/ 536936705, 37, "ISO-2022-KR\0" },
- { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0" }
+ { /*536936705*/ 536936705, 37, "ISO-2022-KR\0csISO2022KR\0" },
+ { /*536941517*/ 536941517, 36, "KS_C_5601-1987\0iso-ir-149\0KS_C_5601-1989\0KSC_5601\0Korean\0csKSC56011987\0" }
};
@@ -659,6 +664,10 @@ QSymbianTextCodec *QSymbianTextCodec::init()
if (charsetId == localeMapperId)
localeMapper = c;
} else {
+ // We did not find the charsetId in our codecsData[], therefore we ask
+ // the OS for the codec name. We first try to get a "standard name" and fall
+ // back to array->At(i).Name(), if really needed. array->At(i).Name() is not
+ // guaranteed to be a correct name for QTextCodec::codecFromName().
QScopedPointer<HBufC8> buf;
QT_TRAP_THROWING(buf.reset(converter->ConvertCharacterSetIdentifierToStandardNameL(charsetId, qt_s60GetRFs())))
QByteArray name;
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index c66813a17a..a531009c39 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -92,6 +92,7 @@ Qt {
Q_ENUMS(ConnectionType)
#ifndef QT_NO_GESTURES
Q_ENUMS(GestureState)
+ Q_ENUMS(GestureType)
#endif
#endif // (defined(Q_MOC_RUN) || defined(QT_JAMBI_RUN))
diff --git a/src/corelib/global/qnumeric.cpp b/src/corelib/global/qnumeric.cpp
index 75fd31e8bd..7ddb9e2902 100644
--- a/src/corelib/global/qnumeric.cpp
+++ b/src/corelib/global/qnumeric.cpp
@@ -44,14 +44,49 @@
QT_BEGIN_NAMESPACE
+/*!
+ Returns true if the double \a {d} is equivalent to infinity.
+*/
Q_CORE_EXPORT bool qIsInf(double d) { return qt_is_inf(d); }
+
+/*!
+ Returns true if the double \a {d} is not a number (NaN).
+*/
Q_CORE_EXPORT bool qIsNaN(double d) { return qt_is_nan(d); }
+
+/*!
+ Returns true if the double \a {d} is a finite number.
+*/
Q_CORE_EXPORT bool qIsFinite(double d) { return qt_is_finite(d); }
+
+/*!
+ Returns true if the float \a {f} is equivalent to infinity.
+*/
Q_CORE_EXPORT bool qIsInf(float f) { return qt_is_inf(f); }
+
+/*!
+ Returns true if the float \a {f} is not a number (NaN).
+*/
Q_CORE_EXPORT bool qIsNaN(float f) { return qt_is_nan(f); }
+
+/*!
+ Returns true if the float \a {f} is a finite number.
+*/
Q_CORE_EXPORT bool qIsFinite(float f) { return qt_is_finite(f); }
+
+/*!
+ Returns the bit pattern of a signalling NaN as a double.
+*/
Q_CORE_EXPORT double qSNaN() { return qt_snan(); }
+
+/*!
+ Returns the bit pattern of a quiet NaN as a double.
+*/
Q_CORE_EXPORT double qQNaN() { return qt_qnan(); }
+
+/*!
+ Returns the bit pattern for an infinite number as a double.
+*/
Q_CORE_EXPORT double qInf() { return qt_inf(); }
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index f6f4b1928d..426f61ee89 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1552,10 +1552,11 @@ bool QDir::makeAbsolute() // ### What do the return values signify?
QScopedPointer<QDirPrivate> dir(new QDirPrivate(*d_ptr.constData()));
dir->setPath(absolutePath);
- if (!(dir->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType))
+ d_ptr = dir.take();
+
+ if (!(d_ptr->fileEngine->fileFlags(QAbstractFileEngine::TypesMask) & QAbstractFileEngine::DirectoryType))
return false;
- d_ptr = dir.take();
return true;
}
diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp
index de96e06230..b3fe734e1b 100644
--- a/src/corelib/io/qsettings_win.cpp
+++ b/src/corelib/io/qsettings_win.cpp
@@ -535,6 +535,15 @@ bool QWinSettingsPrivate::readKey(HKEY parentHandle, const QString &rSubKey, QVa
break;
}
+ case REG_QWORD: {
+ Q_ASSERT(data.size() == sizeof(qint64));
+ qint64 i;
+ memcpy((char*)&i, data.constData(), sizeof(qint64));
+ if (value != 0)
+ *value = i;
+ break;
+ }
+
default:
qWarning("QSettings: Unknown data %d type in Windows registry", static_cast<int>(dataType));
if (value != 0)
@@ -683,10 +692,19 @@ void QWinSettingsPrivate::set(const QString &uKey, const QVariant &value)
break;
}
- case QVariant::Int: {
+ case QVariant::Int:
+ case QVariant::UInt: {
type = REG_DWORD;
- int i = value.toInt();
- regValueBuff = QByteArray((const char*)&i, sizeof(int));
+ qint32 i = value.toInt();
+ regValueBuff = QByteArray((const char*)&i, sizeof(qint32));
+ break;
+ }
+
+ case QVariant::LongLong:
+ case QVariant::ULongLong: {
+ type = REG_QWORD;
+ qint64 i = value.toLongLong();
+ regValueBuff = QByteArray((const char*)&i, sizeof(qint64));
break;
}
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index b320624b28..b122cd26fc 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3464,9 +3464,8 @@ QString QUrlPrivate::canonicalHost() const
that->host = host.toLower();
} else {
that->host = qt_ACE_do(host, NormalizeAce);
- if (that->host.isNull())
- that->isHostValid = false;
}
+ that->isHostValid = !that->host.isNull();
return that->host;
}
@@ -3781,6 +3780,10 @@ void QUrlPrivate::validate() const
QString auth = authority(); // causes the non-encoded forms to be valid
+ // authority() calls canonicalHost() which sets this
+ if (!isHostValid)
+ return;
+
if (scheme == QLatin1String("mailto")) {
if (!host.isEmpty() || port != -1 || !userName.isEmpty() || !password.isEmpty()) {
that->isValid = false;
@@ -3954,9 +3957,10 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
url += scheme.toLatin1();
url += ':';
}
+ QString savedHost = host; // pre-validation, may be invalid!
QString auth = authority();
bool doFileScheme = scheme == QLatin1String("file") && encodedPath.startsWith('/');
- if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority && (!auth.isEmpty() || doFileScheme)) {
+ if ((options & QUrl::RemoveAuthority) != QUrl::RemoveAuthority && (!auth.isEmpty() || doFileScheme || !savedHost.isEmpty())) {
if (doFileScheme && !encodedPath.startsWith('/'))
url += '/';
url += "//";
@@ -3982,6 +3986,12 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
url += '[';
url += host.toLatin1();
url += ']';
+ } else if (host.isEmpty() && !savedHost.isEmpty()) {
+ // this case is only possible with an invalid URL
+ // it's here only so that we can keep the original, invalid hostname
+ // in encodedOriginal.
+ // QUrl::isValid() will return false, so toEncoded() can be anything (it's not valid)
+ url += savedHost.toUtf8();
} else {
url += QUrl::toAce(host);
}
@@ -4101,7 +4111,7 @@ const QByteArray &QUrlPrivate::normalized() const
QString QUrlPrivate::createErrorString()
{
- if (isValid)
+ if (isValid && isHostValid)
return QString();
QString errorString(QLatin1String(QT_TRANSLATE_NOOP(QUrl, "Invalid URL \"")));
@@ -4125,7 +4135,10 @@ QString QUrlPrivate::createErrorString()
errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "\'"));
} else {
errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ": "));
- errorString += QLatin1String(errorInfo._message);
+ if (isHostValid)
+ errorString += QLatin1String(errorInfo._message);
+ else
+ errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, "invalid hostname"));
}
if (errorInfo._found) {
errorString += QLatin1String(QT_TRANSLATE_NOOP(QUrl, ", but found \'"));
@@ -4488,7 +4501,7 @@ void QUrl::setAuthority(const QString &authority)
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
- QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
+ QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized);
d->setAuthority(authority);
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index ad645e32c7..e967884241 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -2115,7 +2115,8 @@ QStringList QCoreApplication::arguments()
l1arg == "-stylesheet" ||
l1arg == "-widgetcount")
;
- else if (l1arg.startsWith("-style="))
+ else if (l1arg.startsWith("-style=") ||
+ l1arg.startsWith("-qmljsdebugger="))
;
else if (l1arg == "-style" ||
l1arg == "-session" ||
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 9dadd82bbd..f50994ce9a 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -549,18 +549,22 @@ int QTimerInfoList::activateTimers()
if (qt_disable_lowpriority_timers || isEmpty())
return 0; // nothing to do
- bool firstTime = true;
- timeval currentTime;
- int n_act = 0, maxCount = count();
+ int n_act = 0, maxCount = 0;
firstTimerInfo = 0;
- while (maxCount--) {
- currentTime = updateCurrentTime();
- if (firstTime) {
- repairTimersIfNeeded();
- firstTime = false;
- }
+ timeval currentTime = updateCurrentTime();
+ repairTimersIfNeeded();
+
+ // Find out how many timer have expired
+ for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
+ if (currentTime < (*it)->timeout)
+ break;
+ maxCount++;
+ }
+
+ //fire the timers.
+ while (maxCount--) {
if (isEmpty())
break;
diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc
new file mode 100644
index 0000000000..48f74b6426
--- /dev/null
+++ b/src/corelib/kernel/qmath.qdoc
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \headerfile <QtCore/qmath.h>
+ \title Math Functions
+ \ingroup funclists
+ \brief The <QtCore/qmath.h> header provides various math functions.
+ \pagekeywords math trigonometry qmath floor ceiling absolute sine cosine tangent inverse tan exponent power natural logarithm
+*/
+
+/*!
+ \fn int qCeil(qreal v)
+ Return the ceiling of the value \a v.
+
+ The ceiling is the smallest integer that is not less than \a v.
+ For example, if \a v is 41.2, then the ceiling is 42.
+
+ \relates <QtCore/qmath.h>
+ \sa qFloor()
+*/
+
+/*!
+ \fn int qFloor(qreal v)
+ Return the floor of the value \a v.
+
+ The floor is the largest integer that is not greater than \a v.
+ For example, if \a v is 41.2, then the floor is 41.
+
+ \relates <QtCore/qmath.h>
+ \sa qCeil()
+*/
+
+/*!
+ \fn qreal qFabs(qreal v)
+ Returns the absolute value of \a v as a qreal.
+*/
+
+/*!
+ \fn qreal qSin(qreal v)
+ Returns the sine of the angle \a v in radians.
+
+ \relates <QtCore/qmath.h>
+ \sa qCos(), qTan()
+*/
+
+/*!
+ \fn qreal qCos(qreal v)
+ Returns the cosine of an angle \a v in radians.
+
+ \relates <QtCore/qmath.h>
+ \sa qSin(), qTan()
+*/
+
+/*!
+ \fn qreal qTan(qreal v)
+ Returns the tangent of an angle \a v in radians.
+
+ \relates <QtCore/qmath.h>
+ \sa qSin(), qCos()
+*/
+
+/*!
+ \fn qreal qAcos(qreal v)
+ Returns the arccosine of \a v as an angle in radians.
+ Arccosine is the inverse operation of cosine.
+
+ \relates <QtCore/qmath.h>
+ \sa qAtan(), qAsin(), qCos()
+*/
+
+/*!
+ \fn qreal qAsin(qreal v)
+ Returns the arcsine of \a v as an angle in radians.
+ Arcsine is the inverse operation of sine.
+
+ \relates <QtCore/qmath.h>
+ \sa qSin(), qAtan(), qAcos()
+*/
+
+/*!
+ \fn qreal qAtan(qreal v)
+ Returns the arctangent of \a v as an angle in radians.
+ Arctangent is the inverse operation of tangent.
+
+ \relates <QtCore/qmath.h>
+ \sa qTan(), qAcos(), qAsin()
+*/
+
+/*!
+ \fn qreal qAtan2(qreal x, qreal y)
+ Returns the arctangent of a point specified by the coordinates \a x and \a y.
+ This function will return the angle and its direction.
+
+ \relates <QtCore/qmath.h>
+ \sa qAtan()
+*/
+
+/*!
+ \fn qreal qSqrt(qreal v)
+ Returns the square root of \a v.
+ This function returns a NaN if \a v is a negative number.
+
+ \relates <QtCore/qmath.h>
+ \sa qPow()
+*/
+
+/*!
+ \fn qreal qLn(qreal v)
+ Returns the natural logarithm of \a v. Natural logarithm uses base e.
+
+ \relates <QtCore/qmath.h>
+ \sa qExp()
+*/
+
+/*!
+ \fn qreal qExp(qreal v)
+ Returns the exponential function of \c e to the power of \a v.
+
+ \relates <QtCore/qmath.h>
+ \sa qLn()
+*/
+
+/*!
+ \fn qreal qPow(qreal x, qreal y)
+ Returns the value of \a x raised to the power of \a y.
+ That is, \a x is the base and \a y is the exponent.
+
+ \relates <QtCore/qmath.h>
+ \sa qSqrt()
+*/
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 52efcd0613..eebb3dbc62 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -156,7 +156,18 @@ void qMetaTypeLoadHelper(QDataStream &stream, T *t)
}
#endif // QT_NO_DATASTREAM
-template <typename T> struct QMetaTypeId2;
+template <typename T>
+struct QMetaTypeId
+{
+ enum { Defined = 0 };
+};
+
+template <typename T>
+struct QMetaTypeId2
+{
+ enum { Defined = QMetaTypeId<T>::Defined };
+ static inline int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
+};
namespace QtPrivate {
template <typename T, bool Defined = QMetaTypeId2<T>::Defined>
@@ -210,19 +221,6 @@ void qRegisterMetaTypeStreamOperators(const char *typeName
#endif // QT_NO_DATASTREAM
template <typename T>
-struct QMetaTypeId
-{
- enum { Defined = 0 };
-};
-
-template <typename T>
-struct QMetaTypeId2
-{
- enum { Defined = QMetaTypeId<T>::Defined };
- static inline int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
-};
-
-template <typename T>
inline int qMetaTypeId(
#ifndef qdoc
T * /* dummy */ = 0
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 6621efb36b..63fdf76801 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -351,7 +351,7 @@ inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QStrin
{ return o->findChild<T>(name); }
template<typename T>
-inline QList<T> qFindChildren(const QObject *o, const QString &name = QString())
+inline QT_DEPRECATED QList<T> qFindChildren(const QObject *o, const QString &name = QString())
{
return o->findChildren<T>(name);
}
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index 5cd022024f..fbfb961fa4 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -41,7 +41,7 @@
/*!
\class QPointer
- \brief The QPointer class is a template class that provides guarded pointers to QObjects.
+ \brief The QPointer class is a template class that provides guarded pointers to QObject.
\ingroup objectmodel
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index 62d565adb2..a26dcd8465 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -244,6 +244,14 @@ QObject *QFactoryLoader::instance(const QString &key) const
return 0;
}
+#ifdef Q_WS_X11
+QLibraryPrivate *QFactoryLoader::library(const QString &key) const
+{
+ Q_D(const QFactoryLoader);
+ return d->keyMap.value(d->cs ? key : key.toLower());
+}
+#endif
+
void QFactoryLoader::refreshAll()
{
QMutexLocker locker(qt_factoryloader_mutex());
diff --git a/src/corelib/plugin/qfactoryloader_p.h b/src/corelib/plugin/qfactoryloader_p.h
index 10e6e2a100..068c6c7c0f 100644
--- a/src/corelib/plugin/qfactoryloader_p.h
+++ b/src/corelib/plugin/qfactoryloader_p.h
@@ -77,6 +77,10 @@ public:
QStringList keys() const;
QObject *instance(const QString &key) const;
+#ifdef Q_WS_X11
+ QLibraryPrivate *library(const QString &key) const;
+#endif
+
void update();
static void refreshAll();
diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp
index a11ed50c10..eeb142bbfc 100644
--- a/src/corelib/plugin/qsystemlibrary.cpp
+++ b/src/corelib/plugin/qsystemlibrary.cpp
@@ -78,7 +78,7 @@
(http://msdn.microsoft.com/en-us/library/ms886736.aspx)
*/
#if defined(Q_OS_WINCE)
-HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory/*= true*/)
+HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */)
{
return ::LoadLibrary(libraryName);
}
@@ -101,7 +101,7 @@ static QString qSystemDirectory()
return QString::fromWCharArray(fullPath.constData(), int(retLen));
}
-HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory/*= true*/)
+HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */)
{
QStringList searchOrder;
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index a3c702a312..d704615b9c 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -2135,6 +2135,7 @@ void QStateMachine::endMicrostep(QEvent *event)
/*!
\reimp
+ This function will call start() to start the state machine.
*/
void QStateMachine::onEntry(QEvent *event)
{
@@ -2144,6 +2145,8 @@ void QStateMachine::onEntry(QEvent *event)
/*!
\reimp
+ This function will call stop() to stop the state machine and
+ subsequently emit the stopped() signal.
*/
void QStateMachine::onExit(QEvent *event)
{
diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp
index 743da24f78..697da38278 100644
--- a/src/corelib/thread/qatomic.cpp
+++ b/src/corelib/thread/qatomic.cpp
@@ -48,10 +48,9 @@
For atomic operations on pointers, see the QAtomicPointer class.
- An complex operation that completes without interruption is said
- to be \e atomic. The QAtomicInt class provides atomic reference
- counting, test-and-set, fetch-and-store, and fetch-and-add for
- integers.
+ An \e atomic operation is a complex operation that completes without interruption.
+ The QAtomicInt class provides atomic reference counting, test-and-set, fetch-and-store,
+ and fetch-and-add for integers.
\section1 Non-atomic convenience operators
@@ -635,9 +634,8 @@
For atomic operations on integers, see the QAtomicInt class.
- An complex operation that completes without interruption is said
- to be \e atomic. The QAtomicPointer class provides atomic
- test-and-set, fetch-and-store, and fetch-and-add for pointers.
+ An \e atomic operation is a complex operation that completes without interruption.
+ The QAtomicPointer class provides atomic test-and-set, fetch-and-store, and fetch-and-add for pointers.
\section1 Non-atomic convenience operators
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index d193b2e1ee..2824e1511c 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -142,6 +142,20 @@ static void destroy_current_thread_data_key()
}
Q_DESTRUCTOR_FUNCTION(destroy_current_thread_data_key)
+#ifdef Q_OS_SYMBIAN
+static void init_symbian_thread_handle(RThread &thread)
+{
+ thread = RThread();
+ TThreadId threadId = thread.Id();
+ thread.Open(threadId);
+
+ // Make thread handle accessible process wide
+ RThread originalCloser = thread;
+ thread.Duplicate(thread, EOwnerProcess);
+ originalCloser.Close();
+}
+#endif
+
QThreadData *QThreadData::current()
{
pthread_once(&current_thread_data_once, create_current_thread_data_key);
@@ -182,9 +196,7 @@ void QAdoptedThread::init()
Q_D(QThread);
d->thread_id = pthread_self();
#ifdef Q_OS_SYMBIAN
- d->data->symbian_thread_handle = RThread();
- TThreadId threadId = d->data->symbian_thread_handle.Id();
- d->data->symbian_thread_handle.Open(threadId);
+ init_symbian_thread_handle(d->data->symbian_thread_handle);
#endif
}
@@ -244,9 +256,8 @@ void *QThreadPrivate::start(void *arg)
// RThread and pthread_t, we must delay initialization of the RThread
// handle when creating a thread, until we are running in the new thread.
// Here, we pick up the current thread and assign that to the handle.
- data->symbian_thread_handle = RThread();
- TThreadId threadId = data->symbian_thread_handle.Id();
- data->symbian_thread_handle.Open(threadId);
+ init_symbian_thread_handle(data->symbian_thread_handle);
+
// On symbian, threads other than the main thread are non critical by default
// This means a worker thread can crash without crashing the application - to
// use this feature, we would need to use RThread::Logon in the main thread
@@ -657,6 +668,18 @@ bool QThread::wait(unsigned long time)
return true;
while (d->running) {
+#ifdef Q_OS_SYMBIAN
+ // Check if thread still exists. Needed because kernel will kill it without notification
+ // before global statics are deleted at application exit.
+ if (d->data->symbian_thread_handle.Handle()
+ && d->data->symbian_thread_handle.ExitType() != EExitPending) {
+ // Cannot call finish here as wait is typically called from another thread.
+ // It won't be necessary anyway, as we should never get here under normal operations;
+ // all QThreads are EProcessCritical and therefore cannot normally exit
+ // undetected (i.e. panic) as long as all thread control is via QThread.
+ return true;
+ }
+#endif
if (!d->thread_done.wait(locker.mutex(), time))
return false;
}
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index f418de9f22..043d6a304d 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -147,7 +147,7 @@ void QCryptographicHash::addData(const char *data, int length)
}
/*!
- /overload
+ \overload addData()
*/
void QCryptographicHash::addData(const QByteArray &data)
{
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index cc90b3ab13..7589f59efb 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -3735,7 +3735,7 @@ QByteArray QString::toUtf8() const
Returns a UCS-4/UTF-32 representation of the string as a QVector<uint>.
UCS-4 is a Unicode codec and is lossless. All characters from this string
- can be encoded in UCS-4.
+ can be encoded in UCS-4. The vector is not null terminated.
\sa fromUtf8(), toAscii(), toLatin1(), toLocal8Bit(), QTextCodec, fromUcs4(), toWCharArray()
*/
@@ -3965,8 +3965,8 @@ QString QString::fromUtf8(const char *str, int size)
This function checks for a Byte Order Mark (BOM). If it is missing,
host byte order is assumed.
- This function is comparatively slow.
- Use QString(const ushort *, int) or QString(const ushort *) if possible.
+ This function is slow compared to the other Unicode conversions.
+ Use QString(const QChar *, int) or QString(const QChar *) if possible.
QString makes a deep copy of the Unicode data.