Can Q_GLOBAL_STATIC replace KStaticDelete ?

Matthias Kretz kretz at
Thu Jan 18 21:22:57 GMT 2007

On Thursday 18 January 2007 20:31, Thiago Macieira wrote:
> Matthias Kretz wrote:
> >The problem is that as soon as you keep any KDE object as a member of a
> > static object you have to be sure it's not going to need a KInstance
> > object on destruction. Do you know whether you're allowed to keep a
> > KDirWatch object? Would you have known that keeping a dirty KConfig
> > object until destruction will crash your program on exit?
> This indicates that the problem is elsewhere. KInstance should be
> refcounted by the number of objects that reference it. It should only be
> deleted when that refcount drops to zero.

Sounds like a good idea to me.

Problem to solve: KApplication derives from KInstance. So if KApplication is 
destructed before the global statics how could KInstance keep itself alive 
long enough? I guess KInstance then has to be a member of KApplication. What 
implications does that have on existing code?

Matthias Kretz (Germany)                            <><
MatthiasKretz at, kretz at,
Matthias.Kretz at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list