Re: memory leaks - pixbuf
- From: Mark Roberts <gtkmm manumark de>
- To: Marcel Claro <marcelnmetal gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: memory leaks - pixbuf
- Date: Mon, 25 May 2009 10:49:24 +0200 (CEST)
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]