Can Q_GLOBAL_STATIC replace KStaticDelete ?

Matthias Kretz kretz at kde.org
Wed Jan 17 14:43:46 GMT 2007


On Wednesday 17 January 2007 12:51, Matthias Kretz wrote:
> I'm working on a K_GLOBAL_STATIC macro right now...

Patch is attached.

A few notes:
- I only took the threaded Q_GLOBAL_STATIC in account as KDE won't be compiled 
with QT_NO_THREAD.
- I believe we need permission from Trolltech to use this, as it probably 
violates their copyright if we licence this as LGPL (dunno if the code in 
question is too small to be a problem, though).
- The destruction code is not thread safe and I believe it doesn't need to be 
(can it happen that ~QCoreApplication and ~KInstance are running in two 
separate threads, or that the static object cleanup happens in more than one 
thread at the same time - or any other combination?)
- Using K_GLOBAL_STATIC for a singleton requires the ctor and dtor of the 
singleton-class to be public. Is there a way to make the static function 
declared by K_GLOBAL_STATIC a friend of the class?

-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kglobalstatic.diff
Type: text/x-diff
Size: 9356 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070117/84995500/attachment.diff>
-------------- 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/84995500/attachment.sig>


More information about the kde-core-devel mailing list