On Wed, 2008-04-30 at 19:10 -0500, Moises wrote: > when I use g_object_unref decreases reference count > and when this hit 0, the object is released, but when > does it hit 0? when the last reference, created by the construction of an object, is removed. instance = g_object_new (type, ...); ... g_object_unref (instance); /* the object is disposed */ > when the program ends and eventually > released all memory or immediately that I used > g_object_unref?. if g_object_unref() has been called and it was the last reference then the object is disposed and the instance becomes a pointer to an invalid object. > because apparently does not work because I have the > following > > imgPixbuf = gdk_pixbuf_new_from_file(xfileName, > error); > ... > g_object_unref (imgPixbuf); > > but still I get data of pixbuf with: you are get garbage, which does not segfault on you for a simple matter of chance. unless the "..." in between did not increase the reference count of the object. > imgPixbuf = gdk_pixbuf_new_from_file(xfileName, > error); > ... > g_object_unref (imgPixbuf); > width=gdk_pixbuf_get_width(imgPixbuf); > > then the object is not destroyed the object is disposed, but not set to NULL. no free/dispose function will set the pointer to NULL for you - at least, not in GLib. ciao, Emmanuele. -- Emmanuele Bassi, W: http://www.emmanuelebassi.net B: http://log.emmanuelebassi.net _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list