summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CoreMacros.cmake2
-rw-r--r--src/corelib/codecs/qtextcodec.cpp8
-rw-r--r--src/corelib/io/qlockfile_unix.cpp4
-rw-r--r--src/corelib/io/qprocess.cpp69
-rw-r--r--src/corelib/io/qprocess_p.h1
-rw-r--r--src/corelib/io/qprocess_win.cpp6
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp6
-rw-r--r--src/corelib/plugin/qfactoryloader.cpp3
-rw-r--r--src/corelib/statemachine/qsignaleventgenerator_p.h2
9 files changed, 66 insertions, 35 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake
index b6124b40cd..f549fead59 100644
--- a/src/corelib/Qt5CoreMacros.cmake
+++ b/src/corelib/Qt5CoreMacros.cmake
@@ -244,6 +244,8 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9)
set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS})
set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
+ set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)
if (Qt5_POSITION_INDEPENDENT_CODE)
set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE})
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 4ed7b00e53..766e48358d 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -600,9 +600,6 @@ QTextCodec* QTextCodec::codecForMib(int mib)
*/
QList<QByteArray> QTextCodec::availableCodecs()
{
-#ifdef QT_USE_ICU
- return QIcuCodec::availableCodecs();
-#else
QMutexLocker locker(textCodecsMutex());
QCoreGlobalData *globalData = QCoreGlobalData::instance();
@@ -616,8 +613,11 @@ QList<QByteArray> QTextCodec::availableCodecs()
codecs += globalData->allCodecs.at(i)->aliases();
}
- return codecs;
+#ifdef QT_USE_ICU
+ codecs += QIcuCodec::availableCodecs();
#endif
+
+ return codecs;
}
/*!
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index db81d65565..1676b71133 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -86,8 +86,10 @@ int QLockFilePrivate::checkFcntlWorksAfterFlock()
if (!file.open())
return 0;
const int fd = file.d_func()->engine()->handle();
+#if defined(LOCK_EX) && defined(LOCK_NB)
if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs
return 0;
+#endif
struct flock flockData;
flockData.l_type = F_WRLCK;
flockData.l_whence = SEEK_SET;
@@ -121,8 +123,10 @@ static bool fcntlWorksAfterFlock()
static bool setNativeLocks(int fd)
{
+#if defined(LOCK_EX) && defined(LOCK_NB)
if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs
return false;
+#endif
struct flock flockData;
flockData.l_type = F_WRLCK;
flockData.l_whence = SEEK_SET;
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index b1861d8038..1be108d0a7 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -727,9 +727,11 @@ void QProcessPrivate::Channel::clear()
\fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus)
This signal is emitted when the process finishes. \a exitCode is the exit
- code of the process, and \a exitStatus is the exit status. After the
- process has finished, the buffers in QProcess are still intact. You can
- still read any data that the process may have written before it finished.
+ code of the process (only valid for normal exits), and \a exitStatus is
+ the exit status.
+ After the process has finished, the buffers in QProcess are still intact.
+ You can still read any data that the process may have written before it
+ finished.
\sa exitStatus()
*/
@@ -1959,7 +1961,7 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
d->program = program;
d->arguments = arguments;
- open(mode);
+ d->start(mode);
}
/*!
@@ -1975,7 +1977,17 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
*/
void QProcess::start(OpenMode mode)
{
- open(mode);
+ Q_D(QProcess);
+ if (d->processState != NotRunning) {
+ qWarning("QProcess::start: Process is already running");
+ return;
+ }
+ if (d->program.isEmpty()) {
+ qWarning("QProcess::start: program not set");
+ return;
+ }
+
+ d->start(mode);
}
/*!
@@ -2008,34 +2020,39 @@ bool QProcess::open(OpenMode mode)
return false;
}
+ d->start(mode);
+ return true;
+}
+
+void QProcessPrivate::start(QIODevice::OpenMode mode)
+{
+ Q_Q(QProcess);
#if defined QPROCESS_DEBUG
qDebug() << "QProcess::start(" << program << ',' << arguments << ',' << mode << ')';
#endif
- d->outputReadBuffer.clear();
- d->errorReadBuffer.clear();
+ outputReadBuffer.clear();
+ errorReadBuffer.clear();
- if (d->stdinChannel.type != QProcessPrivate::Channel::Normal)
- mode &= ~WriteOnly; // not open for writing
- if (d->stdoutChannel.type != QProcessPrivate::Channel::Normal &&
- (d->stderrChannel.type != QProcessPrivate::Channel::Normal ||
- d->processChannelMode == MergedChannels))
- mode &= ~ReadOnly; // not open for reading
+ if (stdinChannel.type != QProcessPrivate::Channel::Normal)
+ mode &= ~QIODevice::WriteOnly; // not open for writing
+ if (stdoutChannel.type != QProcessPrivate::Channel::Normal &&
+ (stderrChannel.type != QProcessPrivate::Channel::Normal ||
+ processChannelMode == QProcess::MergedChannels))
+ mode &= ~QIODevice::ReadOnly; // not open for reading
if (mode == 0)
- mode = Unbuffered;
- QIODevice::open(mode);
-
- d->stdinChannel.closed = false;
- d->stdoutChannel.closed = false;
- d->stderrChannel.closed = false;
+ mode = QIODevice::Unbuffered;
+ q->QIODevice::open(mode);
- d->exitCode = 0;
- d->exitStatus = NormalExit;
- d->processError = QProcess::UnknownError;
- d->errorString.clear();
- d->startProcess();
+ stdinChannel.closed = false;
+ stdoutChannel.closed = false;
+ stderrChannel.closed = false;
- return true;
+ exitCode = 0;
+ exitStatus = QProcess::NormalExit;
+ processError = QProcess::UnknownError;
+ errorString.clear();
+ startProcess();
}
@@ -2219,6 +2236,8 @@ void QProcess::kill()
/*!
Returns the exit code of the last process that finished.
+
+ This value is not valid unless exitStatus() returns NormalExit.
*/
int QProcess::exitCode() const
{
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 2a2cc9fb84..e96cb42f94 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -346,6 +346,7 @@ public:
QWinEventNotifier *processFinishedNotifier;
#endif
+ void start(QIODevice::OpenMode mode);
void startProcess();
#if defined(Q_OS_UNIX) && !defined(Q_OS_QNX)
void execChild(const char *workingDirectory, char **path, char **argv, char **envp);
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index bcc3fe0b0d..f16025752e 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -630,8 +630,9 @@ bool QProcessPrivate::drainOutputPipes()
if (!stdoutReader && !stderrReader)
return false;
- bool readyReadEmitted = false;
+ bool someReadyReadEmitted = false;
forever {
+ bool readyReadEmitted = false;
bool readOperationActive = false;
if (stdoutReader) {
readyReadEmitted |= stdoutReader->waitForReadyRead(0);
@@ -641,12 +642,13 @@ bool QProcessPrivate::drainOutputPipes()
readyReadEmitted |= stderrReader->waitForReadyRead(0);
readOperationActive |= stderrReader->isReadOperationActive();
}
+ someReadyReadEmitted |= readyReadEmitted;
if (!readOperationActive || !readyReadEmitted)
break;
Sleep(100);
}
- return readyReadEmitted;
+ return someReadyReadEmitted;
}
bool QProcessPrivate::waitForReadyRead(int msecs)
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index f152dec5e6..4162e843a7 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -1911,8 +1911,8 @@ Qt::DropActions QAbstractItemModel::supportedDropActions() const
/*!
Returns the actions supported by the data in this model.
- The default implementation returns supportedDropActions() unless specific
- values have been set with setSupportedDragActions().
+ The default implementation returns supportedDropActions(). Reimplement
+ this function if you wish to support additional actions.
supportedDragActions() is used by QAbstractItemView::startDrag() as the
default values when a drag occurs.
@@ -1941,6 +1941,8 @@ void QAbstractItemModel::doSetSupportedDragActions(Qt::DropActions actions)
\obsolete
\fn void QAbstractItemModel::setSupportedDragActions(Qt::DropActions actions)
+ This function is obsolete. Reimplement supportedDragActions() instead.
+
Sets the supported drag \a actions for the items in the model.
\sa supportedDragActions(), {Using drag and drop with item views}
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index c617325e9e..3c8e00519b 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -137,7 +137,8 @@ void QFactoryLoader::update()
//
// ### FIXME find a proper solution
//
- const bool isLoadingDebugAndReleaseCocoa = plugins.contains("libqcocoa_debug.dylib") && plugins.contains("libqcocoa.dylib");
+ const bool isLoadingDebugAndReleaseCocoa = plugins.contains(QStringLiteral("libqcocoa_debug.dylib"))
+ && plugins.contains(QStringLiteral("libqcocoa.dylib"));
#endif
for (int j = 0; j < plugins.count(); ++j) {
QString fileName = QDir::cleanPath(path + QLatin1Char('/') + plugins.at(j));
diff --git a/src/corelib/statemachine/qsignaleventgenerator_p.h b/src/corelib/statemachine/qsignaleventgenerator_p.h
index 4ed43c4edb..160a24e7a3 100644
--- a/src/corelib/statemachine/qsignaleventgenerator_p.h
+++ b/src/corelib/statemachine/qsignaleventgenerator_p.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
+** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
**