Re: memory leaks - pixbuf



Agree with Mark Roberts very much.

On Mon, May 25, 2009 at 6:49 PM, Mark Roberts <gtkmm manumark de> wrote:
Dear Marcel!

> I have memory leaks with use of images...
>
>         Glib::RefPtr<Gdk::Pixbuf> interfaceimage;
>          Image* workimage;
>          Gtk::Image *image;
>          interfaceimage = Gdk::Pixbuf::create_from_file(imagepath);
>          workimage=pixbuftoImage(interfaceimage);
>          image->set(interfaceimage);
>
> Image is my type for images...
>
>             image->clear();
>             interfaceimage.reset();
>             interfaceimage=imagetoPixbuf(workimage);
>             image->set(interfaceimage);

It seems strange to call image->set() on an uninitialised pointer. This is
surely not how Gtk::Image::set(Glib::RefPtr<Gdk::Pixbuf>) is supposed to
be used.

If you do similar things inside your own type "Image", it is possible that
you manage to circumvent the automatic memory mangement provided by
RefPtr<>. How about posting a small but complete program which includes
your type "Image"? I'm sure we can spot a memory leak, if there is one.

All the best,
Mark
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]