| Summary: | Cannot kill child process in KProcess destructor. | ||
|---|---|---|---|
| Product: | [Unmaintained] kdelibs | Reporter: | Gary Cramblitt <garycramblitt> |
| Component: | general | Assignee: | Stephan Kulow <coolo> |
| Status: | RESOLVED NOT A BUG | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | RedHat Enterprise Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Gary Cramblitt
2003-08-12 02:24:42 UTC
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;
}
}
|