KSharedPtr breakage

Frerich Raabe raabe at kde.org
Mon Oct 24 00:47:33 BST 2005

On Sunday 23 October 2005 21:21, David Faure wrote:
> On Sunday 23 October 2005 20:28, Frerich Raabe wrote:
> > How about making KSycocaEntry (and all the stuff that inherits it -
> > KServiceType, KProtocolInfo et cetera) classes with value semantics,
> > making it do all the reference counting internally. So you'd have a
> > 'KServiceType KSycocaFactory::findServiceByName( const QString & )'
> > function and so on.
> >
> > Besides the nice side-effect that value semantics don't even trigger the
> > whole 'Who owns this thing?' thing, it would solve the problem with
> > covariant return types which you get when returning a SharedPtr<Foo>
> > instead of a Foo*.
> Sounds very good to me.

Unfortunately I lied - it doesn't solve the covariant return problem at all. 
It only works if you return *pointers*, not actual objects. :-( Another 
problem I see is that you can't make use of pure virtuals (in KSycocaEntry in 
particular) anymore, but that's just minor.

> I can give a hand for the implementation tomorrow if you want.

I would appreciate it a lot, the Sycoca codebase is quite a web (a poorly 
weaved one, IMHO - the amount of casts is insane, and having comments like 
"//don't reimplement this here but a bit further down the hierarchy" next to 
functions doesn't make things less suspicious), and I find it hard and 
time-consuming to estimate the impact of such a change.

I won't have time for this until late afternoon though.

- Frerich

More information about the kde-core-devel mailing list