Use of Boost library classes in kdecore?

David Jarvie lists at astrojar.org.uk
Sat Jul 7 23:28:06 BST 2007


On Saturday 07 July 2007 18:51:33 Thiago Macieira wrote:
> David Jarvie wrote:
> >QExplicitlySharedDataPointer would be suitable to use with a single
> > class, but it still doesn't cope with implicit conversions between base
> > and derived classes.
>
> If an API returns a pointer, the caller should probably own it.
>
> But the KTimeZone design sounds more like a value-based class instead,
> implicitly shared.

KTimeZone needs to have many pointers referring to one data object, and the 
data object should never be copied except explicitly. The data object needs 
to remain in existence until there are no more pointers to it, and only then 
should it be deleted. If, as currently, simple pointers are used, it is too 
difficult to ensure this because of the large number of KDateTime objects 
which hold pointers to KTimeZone derived instances.

The only safe solution would be to use ref-counted pointer objects, but they 
need to be polymorphic (as I said in my other posting of a few minutes ago). 
I don't know of any KDE or Qt classes that currently provide this.

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm




More information about the kde-core-devel mailing list