On Mon, Nov 03, 2003 at 12:25:12PM +0100, Lars Gullik Bj�nnes wrote:
> Angus Leeming <[EMAIL PROTECTED]> writes:
>
> | Lars Gullik Bj�nnes wrote:
> >
> >> | This is aimed at fixing memory leaks in the case of exceptions...
> >> | (probably not all good, neither does it fix all problems...)
> >>
> >> Updated patch.
> >
> | Shouldn't you change the signature of functions like this and
> | factory.C's createInset, rather than invoke auto_ptr::release?
> >
> | Buffer * BufferList::newBuffer(string const & s, bool ronly)
> >
> | I'd suggest that use of release is exactly contrary to your aims.
>
> Not when it comes to exception safety, my use of release and not
> changing the signatures is really to make the patch a bit more palatable.
>
> Of course I'd prefere to never return or pass as argument a bald
> unhandled pointer from any function. (return a smart_ptr::get() might
> be ok...
Ah... do I smell a possiblity to get
InsetBase * InsetFoo::clone()
back?
[aka:
std::auto_prt<InsetBase> InsetFoo::clone()
{
return std::auto_prt<InsetBase>(new InsetFoo(this));
}
->
InsetBase * InsetFoo::clone()
{
return std::auto_prt<InsetBase>(new InsetFoo(this)).get();
}
->
InsetBase * InsetFoo::clone()
{
return new InsetFoo(this);
}
;-)]
Andre'