[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [API addition] AbstractMediaStream::setAutoDelete
From: Matthias Kretz <kretz () kde ! org>
Date: 2007-08-27 12:32:31
Message-ID: 200708271432.51852.kretz () kde ! org
[Download RAW message or body]
On Monday 27 August 2007, Hans Meine wrote:
> Am Montag, 27. August 2007 13:03:28 schrieb Matthias Kretz:
> > b) The object might be tied to some parts of the application and
> > auto-deleting it could be a problem there (so it would need at least the
> > setAutoDelete(false) possibility - which keeping a MediaSource object
> > wrapping the stream would also achieve)
> > c) If you want to reuse the stream object you don't want it to get
> > deleted automatically (again this could also be solved by keeping a
> > MediaSource object wrapping the stream)
>
> The obvious d) would be refcounting (e.g. thin wrappers or shared_ptr).
> BTW: I would prefer d). ;-)
AbstractMediaStream is a QObject subclass. How do you want to implement a
refcount/shared pointer with a nice API for that (and without blowing up the
implementation)?
> > So, yes, it could be done to pass ownership by default. It's just my
> > feeling that the default should be to not pass ownership.
>
> If ownership is passed, I propose the use of auto_ptr<> to show that in the
> API. (Admittedly, that does not make for a beautiful API, but for a very
> clear one IMHO.)
As I never use auto_ptr<> it doesn't make the API any clearer. I guess most Qt
using developers will have that problem, too.
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
MatthiasKretz@gmx.net, kretz@kde.org,
Matthias.Kretz@urz.uni-heidelberg.de
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic