[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [API addition] AbstractMediaStream::setAutoDelete
From:       Hans Meine <hans_meine () gmx ! net>
Date:       2007-08-27 12:02:21
Message-ID: 200708271402.21386.hans_meine () gmx ! net
[Download RAW message or body]

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). ;-)

> 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.)

Ciao, /  /
     /--/
    /  / ANS
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic