strange KStaticDeleter usage

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sun Apr 22 10:20:45 BST 2007


Hi,

While trying to remove KStaticDeleter I found some places like this:

----------------8<------------------------
static KStaticDeleter<KDBusServiceStarter> dss_sd;
KDBusServiceStarter* KDBusServiceStarter::s_self;

KDBusServiceStarter* KDBusServiceStarter::self()
{
     if ( !s_self )
         dss_sd.setObject( s_self, new KDBusServiceStarter );
     return s_self;
}

KDBusServiceStarter::KDBusServiceStarter()
{
     // Set the singleton instance - useful when a derived 
KDBusServiceStarter
     // was created (before self() was called)
     s_self = this;
}
----------------8<------------------------

Sometimes there is also a dtor where s_self is set to 0 (when s_self == 
this).
I don't think this can work, but also don't know how to replace this 
with K_GLOBAL_STATIC in an easy and clean way.

Any ideas?
Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070422/ac9d9ca2/attachment.sig>


More information about the kde-core-devel mailing list