kiconloader's other api change
Matthias Kretz
kretz at kde.org
Tue Jan 9 09:07:07 GMT 2007
On Tuesday 09 January 2007 09:03, Thiago Macieira wrote:
> 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.
Normally Phonon objects are deleted a lot earlier. The testcase just is an
extreme case (all objects are created without parent and not deleted until
the global Phonon::Factory cleans up), and I believe this should not hang or
crash the program on shutdown.
> Note that qAddPostRoutine doesn't catch exit(3) or abort(3).
But kglobal_freeAll will be called, no? I just need some mechanism that
destructs before QCoreApplication is gone/the Qt global statics are gone.
> >~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.
Yes, I know. But if we really make KGlobal::deleteStaticDeleters() called from
~QCoreApplication there must at least be a warning in the docs of
KStaticDeleter that KApplication and QApplication may not be used anymore.
Perhaps we don't really need QCoreApplication anymore, too, but only the Qt
global statics...
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070109/25d833c9/attachment.sig>
More information about the kde-core-devel
mailing list