[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    strange KStaticDeleter usage
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2007-04-22 9:20:45
Message-ID: 462B28ED.7090505 () gmx ! de
[Download RAW message or body]


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


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic