[cairo] Memory leaks in cairomm
Murray Cumming
murrayc at murrayc.com
Wed Jul 12 09:10:38 PDT 2006
On Mon, 2006-06-12 at 22:06 -0500, Jonathon Jongsma wrote:
> On 6/12/06, Rodrigo Rivas <rodrigorivascosta at gmail.com> wrote:
> > I don't know if I'm missing something, but I've noted that the RefPtr
> > implementation in cairomm leaks memory "always".
> > That is because when you call, say Surface::create(...), it calls
> > basically "new Surface(cairo_surface_create_linear(...))" and returns
> > the new pointer wrapped into a RefPtr<Surface>. The ~RefPtr decrements
> > the ref-counter of the cairo_surface_t object, but it <never> deletes
> > the new'ed Surface object. It's same for every type in cairomm.
>
> wow. yeah, that's a problem.
We think we've fixed this, by making RefPtr a regular smartpointer with
its own refcount, and leaving the C++ instance to do the
referencing/unreferencing in its constructor and destructor.
https://bugs.freedesktop.org/show_bug.cgi?id=7442
Unlike gtkmm, that's good enough for cairomm.
--
Murray Cumming
murrayc at murrayc.com
www.murrayc.com
www.openismus.com
More information about the cairo
mailing list