Ticket #46536: qprocess-nozombies.patch

File qprocess-nozombies.patch, 756 bytes (added by RJVB (René Bertin), 10 years ago)
  • qtbase/src/corelib/io/qprocess_unix.cpp

     
    13121312    processManager()->remove(q);
    13131313}
    13141314
     1315//https://codereview.qt-project.org/#/c/61294/
    13151316bool QProcessPrivate::waitForDeadChild()
    13161317{
    13171318    Q_Q(QProcess);
    13181319
    13191320    // read a byte from the death pipe
    13201321    char c;
    1321     qt_safe_read(deathPipe[0], &c, 1);
     1322    qint64 readcount = qt_safe_read(deathPipe[0], &c, 1);
    13221323
    13231324    // check if our process is dead
    13241325    int exitStatus;
    1325     if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
     1326    if (qt_safe_waitpid(pid_t(pid), &exitStatus, readcount > 0 ? WNOHANG : 0) > 0) {
    13261327        processManager()->remove(q);
    13271328        crashed = !WIFEXITED(exitStatus);
    13281329        exitCode = WEXITSTATUS(exitStatus);