Re: Memory problems with gdk_pixbuf
- From: Tristan Van Berkom <tvb gnome org>
- To: John Coppens <john jcoppens com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Memory problems with gdk_pixbuf
- Date: Tue, 07 Jun 2005 10:30:41 -0400
John Coppens wrote:
On Mon, 06 Jun 2005 14:34:59 -0400
Tristan Van Berkom <tvb gnome org> wrote:
img_item = gnome_canvas_item_new(root,
gnome_canvas_pixbuf_get_type(),
"pixbuf", pxb,
"x", 0.0, "y", 0.0,
"width", pxb_w, "height", pxb_h,
NULL);
gdk_pixbuf_unref(pxb);
You could try:
(gdb) watch ((GObject *)pxb)->ref_count
Thanks Tristan.
Apparently, inside gnome_canvas_item_new, the ref_count gets incremented
three times (to 4), and decremented again to 2, which is fine. The unref
decrements again to 1, which is also correct.
The sentence:
gtk_object_destroy(GTK_OBJECT(img_item));
Does not destroy the pxb item - the ref_count is not changed to 0... I
scanned over the gnomecanvas.c code, but I cannot find any code for
unreferencing the pixbuf... But then I'm not a great programmer and not
faniliar with the gnome insides.
Should I report this as a bug?
If the canvas item does `g_object_ref ()' in it's
set_property() method (or if setting the property results
in a reference increment), then the old pixbuf should be
unreffed when setting a new one & the current pixbuf
should be unreffed in the finalize or dispose method.
If the canvas item doesn't hold a reference to the pixbuf or
if it doesn't balance its references to the pixbuf,
then it is a bug, yes.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]