[cairo] cairomm: Path destruction

Jonathon Jongsma jonathon.jongsma at gmail.com
Sun May 7 21:20:19 PDT 2006


On 5/7/06, Murray Cumming <murrayc at murrayc.com> wrote:
> > On the other hand, the semantics of the current interface don't really
> > give you any clue that you need to delete the Path* that's returned by
> > Context::copy_path() (outside of API documentation which doesn't exist
> > yet for these functions).
>
> So let's just document it.

That's definitely the simplest solution.  But I have to admit that
returning a bare pointer to a heap-allocated object leaves a bit of a
bad taste in my mouth, especially since there are tools available in
C++ (e.g. smart pointers) to significantly reduce the risk of memory
leaks in user code.

> > containers.  And I'd prefer not to add too many extra dependencies to
> > cairomm that don't exist for standard cairo (although boost is
> > probably one of the more acceptable dependencies since it's
> > practically a standard library extension)...
>
> It's not API stable, and doesn't intend to be.

That's a good point -- I'd never actually looked into the stability of
boost libraries before.

Jonner


More information about the cairo mailing list