Rename QProcessPrivate::destroyChannel to closeChannel
The QProcessPrivate::Channel object contains some structures that may survive the closing of the pipe, so calling this function "destroy" is incorrect. Let it be just the closing. For symmetry, the createChannel() function is renamed to openChannel(). Change-Id: I2899214c6e4c25835390b10ccf3931315a91589e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
15a0a6e8c5
commit
0f6b3a01e4
@ -886,9 +886,9 @@ void QProcessPrivate::cleanup()
|
|||||||
notifier = 0;
|
notifier = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
destroyChannel(&stdoutChannel);
|
closeChannel(&stdoutChannel);
|
||||||
destroyChannel(&stderrChannel);
|
closeChannel(&stderrChannel);
|
||||||
destroyChannel(&stdinChannel);
|
closeChannel(&stdinChannel);
|
||||||
destroyPipe(childStartedPipe);
|
destroyPipe(childStartedPipe);
|
||||||
destroyPipe(deathPipe);
|
destroyPipe(deathPipe);
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
@ -906,7 +906,7 @@ bool QProcessPrivate::_q_canReadStandardOutput()
|
|||||||
if (available == 0) {
|
if (available == 0) {
|
||||||
if (stdoutChannel.notifier)
|
if (stdoutChannel.notifier)
|
||||||
stdoutChannel.notifier->setEnabled(false);
|
stdoutChannel.notifier->setEnabled(false);
|
||||||
destroyChannel(&stdoutChannel);
|
closeChannel(&stdoutChannel);
|
||||||
#if defined QPROCESS_DEBUG
|
#if defined QPROCESS_DEBUG
|
||||||
qDebug("QProcessPrivate::canReadStandardOutput(), 0 bytes available");
|
qDebug("QProcessPrivate::canReadStandardOutput(), 0 bytes available");
|
||||||
#endif
|
#endif
|
||||||
@ -962,7 +962,7 @@ bool QProcessPrivate::_q_canReadStandardError()
|
|||||||
if (available == 0) {
|
if (available == 0) {
|
||||||
if (stderrChannel.notifier)
|
if (stderrChannel.notifier)
|
||||||
stderrChannel.notifier->setEnabled(false);
|
stderrChannel.notifier->setEnabled(false);
|
||||||
destroyChannel(&stderrChannel);
|
closeChannel(&stderrChannel);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,7 +1016,7 @@ bool QProcessPrivate::_q_canWrite()
|
|||||||
qint64 written = writeToStdin(stdinChannel.buffer.readPointer(),
|
qint64 written = writeToStdin(stdinChannel.buffer.readPointer(),
|
||||||
stdinChannel.buffer.nextDataBlockSize());
|
stdinChannel.buffer.nextDataBlockSize());
|
||||||
if (written < 0) {
|
if (written < 0) {
|
||||||
destroyChannel(&stdinChannel);
|
closeChannel(&stdinChannel);
|
||||||
processError = QProcess::WriteError;
|
processError = QProcess::WriteError;
|
||||||
q->setErrorString(QProcess::tr("Error writing to process"));
|
q->setErrorString(QProcess::tr("Error writing to process"));
|
||||||
emit q->error(processError);
|
emit q->error(processError);
|
||||||
@ -1160,7 +1160,7 @@ void QProcessPrivate::closeWriteChannel()
|
|||||||
// instead.
|
// instead.
|
||||||
flushPipeWriter();
|
flushPipeWriter();
|
||||||
#endif
|
#endif
|
||||||
destroyChannel(&stdinChannel);
|
closeChannel(&stdinChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -326,7 +326,8 @@ public:
|
|||||||
Channel stdinChannel;
|
Channel stdinChannel;
|
||||||
Channel stdoutChannel;
|
Channel stdoutChannel;
|
||||||
Channel stderrChannel;
|
Channel stderrChannel;
|
||||||
bool createChannel(Channel &channel);
|
bool openChannel(Channel &channel);
|
||||||
|
void closeChannel(Channel *channel);
|
||||||
void closeWriteChannel();
|
void closeWriteChannel();
|
||||||
|
|
||||||
QString program;
|
QString program;
|
||||||
@ -339,7 +340,6 @@ public:
|
|||||||
Q_PIPE childStartedPipe[2];
|
Q_PIPE childStartedPipe[2];
|
||||||
Q_PIPE deathPipe[2];
|
Q_PIPE deathPipe[2];
|
||||||
void destroyPipe(Q_PIPE pipe[2]);
|
void destroyPipe(Q_PIPE pipe[2]);
|
||||||
void destroyChannel(Channel *channel);
|
|
||||||
|
|
||||||
QSocketNotifier *startupSocketNotifier;
|
QSocketNotifier *startupSocketNotifier;
|
||||||
QSocketNotifier *deathNotifier;
|
QSocketNotifier *deathNotifier;
|
||||||
|
@ -377,7 +377,7 @@ void QProcessPrivate::destroyPipe(int *pipe)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QProcessPrivate::destroyChannel(Channel *channel)
|
void QProcessPrivate::closeChannel(Channel *channel)
|
||||||
{
|
{
|
||||||
destroyPipe(channel->pipe);
|
destroyPipe(channel->pipe);
|
||||||
}
|
}
|
||||||
@ -387,7 +387,7 @@ void QProcessPrivate::destroyChannel(Channel *channel)
|
|||||||
|
|
||||||
This function must be called in order: stdin, stdout, stderr
|
This function must be called in order: stdin, stdout, stderr
|
||||||
*/
|
*/
|
||||||
bool QProcessPrivate::createChannel(Channel &channel)
|
bool QProcessPrivate::openChannel(Channel &channel)
|
||||||
{
|
{
|
||||||
Q_Q(QProcess);
|
Q_Q(QProcess);
|
||||||
|
|
||||||
@ -573,9 +573,9 @@ void QProcessPrivate::startProcess()
|
|||||||
processManager()->start();
|
processManager()->start();
|
||||||
|
|
||||||
// Initialize pipes
|
// Initialize pipes
|
||||||
if (!createChannel(stdinChannel) ||
|
if (!openChannel(stdinChannel) ||
|
||||||
!createChannel(stdoutChannel) ||
|
!openChannel(stdoutChannel) ||
|
||||||
!createChannel(stderrChannel) ||
|
!openChannel(stderrChannel) ||
|
||||||
qt_create_pipe(childStartedPipe) != 0 ||
|
qt_create_pipe(childStartedPipe) != 0 ||
|
||||||
qt_create_pipe(deathPipe) != 0) {
|
qt_create_pipe(deathPipe) != 0) {
|
||||||
processError = QProcess::FailedToStart;
|
processError = QProcess::FailedToStart;
|
||||||
|
@ -158,7 +158,7 @@ static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle)
|
|||||||
|
|
||||||
This function must be called in order: stdin, stdout, stderr
|
This function must be called in order: stdin, stdout, stderr
|
||||||
*/
|
*/
|
||||||
bool QProcessPrivate::createChannel(Channel &channel)
|
bool QProcessPrivate::openChannel(Channel &channel)
|
||||||
{
|
{
|
||||||
Q_Q(QProcess);
|
Q_Q(QProcess);
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QProcessPrivate::destroyChannel(Channel *channel)
|
void QProcessPrivate::closeChannel(Channel *channel)
|
||||||
{
|
{
|
||||||
if (channel == &stdinChannel) {
|
if (channel == &stdinChannel) {
|
||||||
delete stdinChannel.writer;
|
delete stdinChannel.writer;
|
||||||
@ -473,9 +473,9 @@ void QProcessPrivate::startProcess()
|
|||||||
|
|
||||||
q->setProcessState(QProcess::Starting);
|
q->setProcessState(QProcess::Starting);
|
||||||
|
|
||||||
if (!createChannel(stdinChannel) ||
|
if (!openChannel(stdinChannel) ||
|
||||||
!createChannel(stdoutChannel) ||
|
!openChannel(stdoutChannel) ||
|
||||||
!createChannel(stderrChannel))
|
!openChannel(stderrChannel))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString args = qt_create_commandline(program, arguments);
|
QString args = qt_create_commandline(program, arguments);
|
||||||
|
@ -62,7 +62,7 @@ void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
|
|||||||
Q_UNUSED(pipe);
|
Q_UNUSED(pipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QProcessPrivate::destroyChannel(Channel *channel)
|
void QProcessPrivate::closeChannel(Channel *channel)
|
||||||
{
|
{
|
||||||
Q_UNUSED(channel);
|
Q_UNUSED(channel);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user