[PATCH] KGlobal cleanup
David Faure
faure at kde.org
Mon May 21 14:39:11 BST 2007
On Monday 21 May 2007, Matthias Kretz wrote:
> On Monday 21 May 2007, Matthias Kretz wrote:
> > inline KGlobalPrivate()
> >
> > : stringDict(0),
> >
> > locale(0),
> > - charsets(0),
> > - staticDeleters(new KStaticDeleterList)
> > + charsets(0)
> > {
> > - qAddPostRoutine(KGlobalPrivate::syncConfigs);
> > + // make sure all Qt global statics are created here, that way
> > we may use them in the + // dtor as well
> > + qrand();
> > + //qAddPostRoutine(KGlobalPrivate::syncConfigs);
> > }
> >
> > inline ~KGlobalPrivate()
> > {
> > + //qRemovePostRoutine(KGlobalPrivate::syncConfigs);
>
> Ups, I actually didn't mean to send this, but now that it's out what do you
> think of this hack instead of a Qt post routine? The idea is that, since
> function local statics are destructed in the reverse order in which they were
> constructed, a call to qrand() in KGlobalPrivate() will ensure that the
> global static qrand() depends on is still available when ~KGlobalPrivate is
> called.
This would allow to use KConfig in global object destructors (because KConfig -> QTemporaryFile -> qrand)?
Nice solution then.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list