QProcess: do not emit aboutToClose() twice

This signal is emitted by the QIODevice itself, so we don't have to
emit it from QProcess::close().

Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit efb90f6e7ed3e8d4f7b6c0fb96012cb3a9a9d037)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alex Trotsenko 2021-09-11 19:52:43 +03:00 committed by Qt Cherry-pick Bot
parent 7b930750b1
commit 4a6618ca68
2 changed files with 2 additions and 1 deletions

View File

@ -1669,7 +1669,6 @@ qint64 QProcess::processId() const
void QProcess::close()
{
Q_D(QProcess);
emit aboutToClose();
while (waitForBytesWritten(-1))
;
kill();

View File

@ -835,6 +835,7 @@ void tst_QProcess::closeReadChannel()
void tst_QProcess::openModes()
{
QProcess proc;
QSignalSpy spyAboutToClose(&proc, &QProcess::aboutToClose);
QVERIFY(!proc.isOpen());
QCOMPARE(proc.openMode(), QProcess::NotOpen);
proc.start("testProcessEcho3/testProcessEcho3");
@ -870,6 +871,7 @@ void tst_QProcess::openModes()
QVERIFY(!proc.isOpen());
QVERIFY(!proc.isReadable());
QVERIFY(!proc.isWritable());
QCOMPARE(spyAboutToClose.count(), 1);
QCOMPARE(proc.state(), QProcess::NotRunning);
}