Version: Gideon 3.0.0a5 (using KDE KDE 3.1) Installed from: RedHat RPMs OS: Linux I'm working on a KPart that uses KProcess to launch a child process in runmode NotifyOnExit. I need to terminate child process with SIGTERM (not SIGKILL) if my KPart is closed/destroyed. I cannot call KProcess->kill(SIGTERM) in the KProcess destructor (no error; simply doesn't do anything). My guess is that KProcessController has already been destroyed by the time KProcess destructor is called. Since my component is a KPart, I cannot hook application queryClose events, etc. Please enhance KProcess to either: 1. Invoke KProcess destructor before KProcessController is destroyed (assuming that is the problem), or 2. Allow to override default SIGKILL when KProcess is destroyed with SIGTERM, or 3. Expose an event or signal that KProcess is about to be destroyed before KProcessController is destroyed, or 4. Expose en event or signal that KProcessController is about to be destroyed, or 5. Enhance KParts to emit event or signal that user has requested close/destruction, ala KMainWindow::queryClose(). Option 2 might be the simplest solution, but would need to be overridable per KProcess instance. Options 5 would be the best general-purpose solution. I can supply my source code, if needed, but it is a bit long. Thanks.
Resolving this bug to INVALID. It turns out that one must call KProcess->wait() after calling kill(SIGTERM) in order for the child process to exit. The following code in my KPart destructor solved the problem. kspeakPart::~kspeakPart() { kdDebug() << "kspeakPart destructor called." << endl; if (m_process != NULL) { if (m_process->isRunning()) { m_process->kill(SIGTERM); kdDebug() << "SIGTERM sent from kspeakPart destructor." << endl; m_process->wait(2); } // When a KProcess is destroyed, it sends a SIGKILL to the child process. // In our case, that won't stop speaking, because the signal handler in speakfile // won't get a chance to signal the grandchild processes. delete m_process; m_process = NULL; } }