[PATCH] KGlobal cleanup

Matthias Kretz kretz at kde.org
Mon May 21 14:11:33 BST 2007


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. (The function local static in K_GLOBAL_STATIC is only initialized 
after the ctor was run, so with the pre-4.3 Q_GLOBAL_STATIC this wouldn't 
work.)

Ok, if I commit this too? (All backtraces with ~KGlobalPrivate in the 
stacktrace can be sent to me. :-) )

-- 
________________________________________________________
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/20070521/d58ddb22/attachment.sig>


More information about the kde-core-devel mailing list