From 821af41cf212a269083231d46833a2366ed99326 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 26 Jan 2021 20:45:02 +0200 Subject: QProcess/Unix: simplify notifiers deactivation To minimize code duplication, move the socket notifier deletion to the closeChannel() function, where the pipe descriptor will be closed. Change-Id: If75ba1c955c706ae6e2b3d9f53f7a25e4aa32fa7 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/corelib/io/qprocess.cpp') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 05aa0f021f..8b26e845a8 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -867,18 +867,6 @@ void QProcessPrivate::cleanup() pid = 0; #endif - if (stdoutChannel.notifier) { - delete stdoutChannel.notifier; - stdoutChannel.notifier = nullptr; - } - if (stderrChannel.notifier) { - delete stderrChannel.notifier; - stderrChannel.notifier = nullptr; - } - if (stdinChannel.notifier) { - delete stdinChannel.notifier; - stdinChannel.notifier = nullptr; - } if (stateNotifier) { delete stateNotifier; stateNotifier = nullptr; @@ -1052,8 +1040,6 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel) } if (readBytes == 0) { // EOF - if (channel->notifier) - channel->notifier->setEnabled(false); closeChannel(channel); #if defined QPROCESS_DEBUG qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", @@ -1224,10 +1210,7 @@ void QProcessPrivate::closeWriteChannel() #if defined QPROCESS_DEBUG qDebug("QProcessPrivate::closeWriteChannel()"); #endif - if (stdinChannel.notifier) { - delete stdinChannel.notifier; - stdinChannel.notifier = nullptr; - } + #ifdef Q_OS_WIN // ### Find a better fix, feeding the process little by little // instead. -- cgit v1.2.3