[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: little KProcess problem
From:       Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date:       1999-05-31 22:16:55
[Download RAW message or body]

On Pá, 28 kvě 1999, Johannes Sixt wrote :
>On Fri, 28 May 1999, Lubos Lunak wrote:
>>Hello,
>>
>>I'm now writing non-blocking gethostbyname() for KBiff. While the multithreaded
>>version was piece of cake, fork()-ing drives me nutts. KProcess helped quite a
>>lot and it's almost done already, but it causes another problem : I have all
>>KProcesses in my class in a static QList, and if some of them are still running
>>while I quit the app, it segfaults. The reason is that KProcessController is
>>destroyed in ~KApplication() and it's called before the destructor of my list.
>>Could it be changed that it will be destroyed later, at least in 2.0 libs (
>>I'll have to do some workaround for it now anyway ) ? Using atexit() is the
>>best way of handling deleting of such global data I'm aware of, though there
>>still may be some problems. Or is there a better way of doing this ?
>
>Derive a class from KApplication and empty the QList in its destructor. (And
>kill away the still running children also!)
>
>Think about it: Your application is terminating. The destructor of the
>KApplication-derived class is the right way to clean up. Of course, you should
>only remove the QList entries, the QList object itself will be destroyed later,
>but that doesn't hurt since it will be empty by that time!

Ok, I know I can do this ( and it looks like I'll have to ), but I don't like it
much this way. The classes for the gethostbyname() stuff are KBiff-independent,
so I'd prefer atexit()-ing it or being able to get a function called when
KApplication gets destroyed without calling it explicitly in KMyWhateverApp
destructor whenever it's used.
I thought KApplication::shutDown() could solve it, but it seems to be emited
only when the app is forced to exit ( is the shutDown() signal really intended
to work this way ? ).

 Lubos Lunak
 l.lunak@email.cz

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic