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().

Pick-to: 6.1 6.2
Change-Id: I9165b3eebadc17a66cc834d5ef54441d13f23d7d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alex Trotsenko 2021-09-11 19:52:43 +03:00
parent 53d1e26ff5
commit efb90f6e7e
2 changed files with 2 additions and 1 deletions

View File

@ -1567,7 +1567,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);
}