summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qfsfileengine.cpp27
-rw-r--r--src/corelib/io/qsettings.cpp12
-rw-r--r--src/corelib/kernel/qobject.cpp7
-rw-r--r--src/corelib/thread/qfuture.qdoc2
4 files changed, 23 insertions, 25 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 674742fbf6..42250b629d 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -160,15 +160,9 @@ QFSFileEngine::~QFSFileEngine()
Q_D(QFSFileEngine);
if (d->closeFileHandle) {
if (d->fh) {
- int ret;
- do {
- ret = fclose(d->fh);
- } while (ret == EOF && errno == EINTR);
+ fclose(d->fh);
} else if (d->fd != -1) {
- int ret;
- do {
- ret = QT_CLOSE(d->fd);
- } while (ret == -1 && errno == EINTR);
+ QT_CLOSE(d->fd);
}
}
d->unmapAll();
@@ -365,15 +359,14 @@ bool QFSFileEnginePrivate::closeFdFh()
// Close the file if we created the handle.
if (closeFileHandle) {
int ret;
- do {
- if (fh) {
- // Close buffered file.
- ret = fclose(fh) != 0 ? -1 : 0;
- } else {
- // Close unbuffered file.
- ret = QT_CLOSE(fd);
- }
- } while (ret == -1 && errno == EINTR);
+
+ if (fh) {
+ // Close buffered file.
+ ret = fclose(fh);
+ } else {
+ // Close unbuffered file.
+ ret = QT_CLOSE(fd);
+ }
// We must reset these guys regardless; calling close again after a
// failed close causes crashes on some systems.
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 01a70720ee..f6cd5aa7c9 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -672,11 +672,11 @@ void QSettingsPrivate::iniEscapedString(const QString &str, QByteArray &result,
}
}
-inline static void iniChopTrailingSpaces(QString &str)
+inline static void iniChopTrailingSpaces(QString &str, int limit)
{
int n = str.size() - 1;
QChar ch;
- while (n >= 0 && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t')))
+ while (n >= limit && ((ch = str.at(n)) == QLatin1Char(' ') || ch == QLatin1Char('\t')))
str.truncate(n--);
}
@@ -734,6 +734,7 @@ StSkipSpaces:
// fallthrough
StNormal:
+ int chopLimit = stringResult.length();
while (i < to) {
switch (str.at(i)) {
case '\\':
@@ -771,6 +772,7 @@ StNormal:
} else {
// the character is skipped
}
+ chopLimit = stringResult.length();
break;
case '"':
++i;
@@ -782,7 +784,7 @@ StNormal:
case ',':
if (!inQuotedString) {
if (!currentValueIsQuoted)
- iniChopTrailingSpaces(stringResult);
+ iniChopTrailingSpaces(stringResult, chopLimit);
if (!isStringList) {
isStringList = true;
stringListResult.clear();
@@ -822,6 +824,8 @@ StNormal:
}
}
}
+ if (!currentValueIsQuoted)
+ iniChopTrailingSpaces(stringResult, chopLimit);
goto end;
StHexEscape:
@@ -861,8 +865,6 @@ StOctEscape:
}
end:
- if (!currentValueIsQuoted)
- iniChopTrailingSpaces(stringResult);
if (isStringList)
stringListResult.append(stringResult);
return isStringList;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 337ea7da3c..492031d7fe 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1465,14 +1465,14 @@ void QObject::moveToThread(QThread *targetThread)
}
QThreadData *currentData = QThreadData::current();
- QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : new QThreadData(0);
+ QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : Q_NULLPTR;
if (d->threadData->thread == 0 && currentData == targetData) {
// one exception to the rule: we allow moving objects with no thread affinity to the current thread
currentData = d->threadData;
} else if (d->threadData != currentData) {
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
"Cannot move to target thread (%p)\n",
- currentData->thread, d->threadData->thread, targetData->thread);
+ currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR);
#ifdef Q_OS_MAC
qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. "
@@ -1486,6 +1486,9 @@ void QObject::moveToThread(QThread *targetThread)
// prepare to move
d->moveToThread_helper();
+ if (!targetData)
+ targetData = new QThreadData(0);
+
QOrderedMutexLocker locker(&currentData->postEventList.mutex,
&targetData->postEventList.mutex);
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc
index 6966047c13..92f21fc512 100644
--- a/src/corelib/thread/qfuture.qdoc
+++ b/src/corelib/thread/qfuture.qdoc
@@ -89,7 +89,7 @@
/*! \fn QFuture::QFuture()
- Constructs an empty future.
+ Constructs an empty, canceled future.
*/
/*! \fn QFuture::QFuture(const QFuture &other)