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:
Thiago Macieira 2014-06-05 14:32:02 -07:00 committed by The Qt Project
parent 15a0a6e8c5
commit 0f6b3a01e4
5 changed files with 20 additions and 20 deletions

View File

@ -886,9 +886,9 @@ void QProcessPrivate::cleanup()
notifier = 0;
}
#endif
destroyChannel(&stdoutChannel);
destroyChannel(&stderrChannel);
destroyChannel(&stdinChannel);
closeChannel(&stdoutChannel);
closeChannel(&stderrChannel);
closeChannel(&stdinChannel);
destroyPipe(childStartedPipe);
destroyPipe(deathPipe);
#ifdef Q_OS_UNIX
@ -906,7 +906,7 @@ bool QProcessPrivate::_q_canReadStandardOutput()
if (available == 0) {
if (stdoutChannel.notifier)
stdoutChannel.notifier->setEnabled(false);
destroyChannel(&stdoutChannel);
closeChannel(&stdoutChannel);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::canReadStandardOutput(), 0 bytes available");
#endif
@ -962,7 +962,7 @@ bool QProcessPrivate::_q_canReadStandardError()
if (available == 0) {
if (stderrChannel.notifier)
stderrChannel.notifier->setEnabled(false);
destroyChannel(&stderrChannel);
closeChannel(&stderrChannel);
return false;
}
@ -1016,7 +1016,7 @@ bool QProcessPrivate::_q_canWrite()
qint64 written = writeToStdin(stdinChannel.buffer.readPointer(),
stdinChannel.buffer.nextDataBlockSize());
if (written < 0) {
destroyChannel(&stdinChannel);
closeChannel(&stdinChannel);
processError = QProcess::WriteError;
q->setErrorString(QProcess::tr("Error writing to process"));
emit q->error(processError);
@ -1160,7 +1160,7 @@ void QProcessPrivate::closeWriteChannel()
// instead.
flushPipeWriter();
#endif
destroyChannel(&stdinChannel);
closeChannel(&stdinChannel);
}
/*!

View File

@ -326,7 +326,8 @@ public:
Channel stdinChannel;
Channel stdoutChannel;
Channel stderrChannel;
bool createChannel(Channel &channel);
bool openChannel(Channel &channel);
void closeChannel(Channel *channel);
void closeWriteChannel();
QString program;
@ -339,7 +340,6 @@ public:
Q_PIPE childStartedPipe[2];
Q_PIPE deathPipe[2];
void destroyPipe(Q_PIPE pipe[2]);
void destroyChannel(Channel *channel);
QSocketNotifier *startupSocketNotifier;
QSocketNotifier *deathNotifier;

View File

@ -377,7 +377,7 @@ void QProcessPrivate::destroyPipe(int *pipe)
}
}
void QProcessPrivate::destroyChannel(Channel *channel)
void QProcessPrivate::closeChannel(Channel *channel)
{
destroyPipe(channel->pipe);
}
@ -387,7 +387,7 @@ void QProcessPrivate::destroyChannel(Channel *channel)
This function must be called in order: stdin, stdout, stderr
*/
bool QProcessPrivate::createChannel(Channel &channel)
bool QProcessPrivate::openChannel(Channel &channel)
{
Q_Q(QProcess);
@ -573,9 +573,9 @@ void QProcessPrivate::startProcess()
processManager()->start();
// Initialize pipes
if (!createChannel(stdinChannel) ||
!createChannel(stdoutChannel) ||
!createChannel(stderrChannel) ||
if (!openChannel(stdinChannel) ||
!openChannel(stdoutChannel) ||
!openChannel(stderrChannel) ||
qt_create_pipe(childStartedPipe) != 0 ||
qt_create_pipe(deathPipe) != 0) {
processError = QProcess::FailedToStart;

View File

@ -158,7 +158,7 @@ static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle)
This function must be called in order: stdin, stdout, stderr
*/
bool QProcessPrivate::createChannel(Channel &channel)
bool QProcessPrivate::openChannel(Channel &channel)
{
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) {
delete stdinChannel.writer;
@ -473,9 +473,9 @@ void QProcessPrivate::startProcess()
q->setProcessState(QProcess::Starting);
if (!createChannel(stdinChannel) ||
!createChannel(stdoutChannel) ||
!createChannel(stderrChannel))
if (!openChannel(stdinChannel) ||
!openChannel(stdoutChannel) ||
!openChannel(stderrChannel))
return;
QString args = qt_create_commandline(program, arguments);

View File

@ -62,7 +62,7 @@ void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
Q_UNUSED(pipe);
}
void QProcessPrivate::destroyChannel(Channel *channel)
void QProcessPrivate::closeChannel(Channel *channel)
{
Q_UNUSED(channel);
}