Re: memory leaks - pixbuf



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]