I have created two programs A and B. B is designed to be as a 32-bits QProcess started within a 64-bits A. These programs communicate nicely via stdin, stdout and QSharedMemory.
A:A() {
QProcess *p = new QProcess(this);
p->start("B.exe");
}
A:~A() {
p->deleteLater();
}
Now, if A is closed B will also be shut down. However, if I in Windows Task Manager ends the process A, B will keep living on the loose, and the cpu usage of B will be through the roof. Why?
How can I shut down B if A is immediately destroyed?
Try to close()
(or kill()
) the other process from your DTOR and do a raw delete p
afterwards. I had a similar issue when using a QextSerialPort object which, too, tended to stay around as a ghost when deleted with deleteLater(), however promptly packed up and left when immediately deleted.