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

List:       koffice-devel
Subject:    Re: [patch] koffice/libs/: port K3StaticDeleter to K_GLOBAL_STATIC
From:       Jaroslaw Staniek <js () iidea ! pl>
Date:       2008-08-27 10:39:35
Message-ID: 48B52EE7.4060909 () iidea ! pl
[Download RAW message or body]

Jaroslaw Staniek said the following, On 2008-08-27 12:30:

> Example:
> 
> KoShapeRegistry* KoShapeRegistry::instance()
> {
>     K_GLOBAL_STATIC(KoShapeRegistry, s_singleton)
>     if (!s_singleton->exists())

Should be if (!s_singleton.exists())

>         s_singleton->init();
>     return s_singleton;
> }

BTW, looks like neither the K3StaticDeleter solution nor K_GLOBAL_STATIC 
solution is thread-safe - init() could be called many times...

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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