One more question to kstaticdelter

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Sat Apr 28 18:49:12 BST 2007


Hi,

kconfig_compiler creates code like this:

Settings *Settings::mSelf = 0;
static KStaticDeleter<Settings> staticSettingsDeleter;

Settings *Settings::self()
{
   if ( !mSelf ) {
     staticSettingsDeleter.setObject( mSelf, new Settings() );
     mSelf->readConfig();
   }

   return mSelf;
}

Settings::Settings(  )
   : KConfigSkeleton( QLatin1String( "kgetrc" ) )
{
   mSelf = this;
   ..

}

Settings::~Settings()
{
   if ( mSelf == this )
     staticSettingsDeleter.setObject( mSelf, 0, false );
}

What's the best way to replace this? I would use a QBasicAtomicPointer 
and qAddPostRoutine()... but I won't break kconfig_compiler so I ask you :)

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/20070428/37c455a5/attachment.sig>


More information about the kde-core-devel mailing list