Can Q_GLOBAL_STATIC replace KStaticDelete ?

Olivier Goffart ogoffart at kde.org
Wed Jan 17 15:38:30 GMT 2007


Le mercredi 17 janvier 2007 15:43, Matthias Kretz a écrit :
> On Wednesday 17 January 2007 12:51, Matthias Kretz wrote:
> > I'm working on a K_GLOBAL_STATIC macro right now...
>
> Patch is attached.

> +class KGlobalStaticsList: public QList<KGlobalStaticBase*>
> +{
> +};

typedef ?

> +class KGlobalStaticBase
> +{
> +    public:
> +        virtual ~KGlobalStaticBase() {}
> +        virtual void destroy() = 0;
> +};

The ~KGlobalStaticBase destructor must not be inline  file, see the comment in 
kstaticdeleter.cpp

>  ~KInstance
>  {
> +    KGlobal::deleteGlobalStatics();

Does this works if we have several KInstance (for plugins) ?
When plugin are unloaded that will remove all singletons... bad


Also, all of this should be documented.

-------------- 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/20070117/3ed30db2/attachment.sig>


More information about the kde-core-devel mailing list