[API addition] AbstractMediaStream::setAutoDelete

Hans Meine hans_meine at gmx.net
Mon Aug 27 13:02:21 BST 2007


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




More information about the kde-core-devel mailing list