Detaching [QK]Process
Thiago Macieira
thiago at kde.org
Thu Jun 21 09:31:54 BST 2007
Andreas Pakulat said:
> On 21.06.07 06:36:13, Thiago Macieira wrote:
>> Alex Merry wrote:
>> >While trying to do the last remaining port from K3Process to KProcess
>> in
>> >kdelibs, I ran across a problem.
>> >
>> >KFileSharePropsPlugin [kio/kfile/kfilesharedialog.cpp] uses
>> >K3Process::detach() in its destructor to make sure the kdesu process it
>> >starts does not get terminated when KFileSharePropsPlugin is destroyed.
>> > KProcess does not appear to have a similar method.
>> >
>> >I thought QProcess::close() might do it (the APIDOX suggest so), but -
>> >looking at the source code - it actually kills the process.
>> >
>> >Any ideas on what to do?
>>
>> Leave K3Process.
>
> Not a good option I think, or do K3Process and Q/KProcess nowadays work
> well together? My last information on this is that they shouldn't be
> used in the same application because you'll loose the ability to get the
> signals from the started process.
Not a good option, but your only other option is to modify the code so
that it doesn't need to detach.
Your last information is correct. But I think we can make K3Process work
by making it start a dummy process with QProcess (so that the Qt signal
handler is installed), then installing a secondary signal handler in
K3Process -- i.e., a cascade.
Yes, an ugly hack. It's too bad that Unix doesn't let us install multiple
signal handlers... like QObject::connect. I wonder how I can make a
suggestion to the POSIX standard...
> AFAIK Oswald wanted to add a detach() to KProcess.
That's not going to happen for KDE 4.0 / Qt 4.3. It might be possible for
the next versions if Qt 4.4 changes internally a bit to accommodate.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
More information about the kde-core-devel
mailing list