kiconloader's other api change

Thiago Macieira thiago at
Tue Jan 9 08:03:01 GMT 2007

David Faure wrote:
>The trouble, as Matthias Kretz discovered, is that when quitting the
> app, q_global_static objects are deleted after QCoreApplication is
> deleted. This breaks when destructor code needs qapp, or qtimer, etc.

Most destructors shouldn't need this. The classes that are global and 
static should be prepared to not be deleted at all! So, if they hold 
resources open that need cleaning up (erasing files, etc.), they need 
more involved methods of destruction.

Note that qAddPostRoutine doesn't catch exit(3) or abort(3).

>~KApplication destroys all kstaticdeleters, so in kde3 we made sure that
> it was done before there is no app anymore. This is still true in kde4,
> but kapplication isn't used as everywhere as in kde3, so when using
> either kstaticdeleter or Q_GLOBAL_STATIC, the destructor code runs
> after the application was destroyed. We can try to stay away from
> "intelligent" destructors, of course, but let's hope that's enough.
> Otherwise Matthias had the idea of using qAddPostRoutine to trigger
> that "iterate through global objects and delete them" code before
> ~QApplication runs.

Note that qAddPostRoutine is run at ~QCoreApplication, so there is no 
QApplication or KApplication anymore by the time they are run. Do not 
call any such routines from the callbacks.

  Thiago Macieira  -  thiago (AT) - thiago (AT)
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- 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