Avoid doing kill(-1) in QProcess destructor

It can happen under unspecified conditions, see relevant ticket.

Task-number: QTBUG-86285
Pick-to: 5.15
Change-Id: I1f77bf0061a0faaa60283bb93fc3d82031247d54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Dimitrios Apostolou 2020-09-10 19:27:44 +02:00
parent 4d269b4561
commit 743ffcbc82

View File

@ -504,6 +504,7 @@ void QProcessPrivate::startProcess()
}
pid = qint64(childPid);
Q_ASSERT(pid > 0);
// parent
// close the ends we don't use and make all pipes non-blocking
@ -691,18 +692,18 @@ bool QProcessPrivate::writeToStdin()
void QProcessPrivate::terminateProcess()
{
#if defined (QPROCESS_DEBUG)
qDebug("QProcessPrivate::terminateProcess()");
qDebug("QProcessPrivate::terminateProcess() pid=%jd", intmax_t(pid));
#endif
if (pid)
if (pid > 0)
::kill(pid_t(pid), SIGTERM);
}
void QProcessPrivate::killProcess()
{
#if defined (QPROCESS_DEBUG)
qDebug("QProcessPrivate::killProcess()");
qDebug("QProcessPrivate::killProcess() pid=%jd", intmax_t(pid));
#endif
if (pid)
if (pid > 0)
::kill(pid_t(pid), SIGKILL);
}