[Kst] branches/work/kst/kst1kde4/kst/src/libkst

Peter Kümmel syntheticpp at gmx.net
Thu Nov 19 18:49:12 CET 2009


Barth Netterfield wrote:
> On November 19, 2009 11:43:27 am Peter Kümmel wrote:
>> do we need the 'Explicitly' version?
> 
> Explicitly shared objects inherit from a class which keeps track of their 
> usage counts internally.  With QShared, the pointer itself keeps tack of usage 
> - which is harder to manage.
> 
> cbn


I know the Qt's classes where QSharedData is used to implement
shared data classes.
Implicit or "copy on write" classes, like most of Qt's classes, use
QSharedDataPointer internally, classes which do not support "copy
on write" and
where you have to detach manually (explicit) uses
QExplicitlySharedDataPointer internally:
http://doc.qt.nokia.com/4.6-snapshot/qshareddata.html

For reference counting there is QSharedPointer.

We should map kst's classes to Qt's classes, and therefore the
question:
Do we need shared data objects where we have to call detach() or
is "copy on write"
enough. "copy on write" is less error prone because you could not
forget to call
detach.

Peter


More information about the Kst mailing list