On Mon, 2005-08-15 at 16:29 -0400, Tristan Van Berkom wrote: > Wallace Owen wrote: > > How can I see what the current reference count is, so I can be sure I'm > > using g_object_ref() and g_object_unref() correctly? > > You can check G_OBJECT (object)->ref_count, note that it is > fundementally wrong to do any conditional code based on this > (for the same reason you cant check if any free'd memory is > actually free'd) but it may help you debug.
Yow! I guess I was going to use it incorrectly. I had searched through the demos for code that called g_object_unref(), and searched the API docs installed on my machine, and searched the tutorials on the GTK site for clues about when to bump the reference count and when to decrement it. What I did not see was documentation telling me which gtk library functions would increment the count. I assumed, after my search, that putting a widget into a container would increment it's reference count. But no, adding code to show the refcount after adding the widget to the container, that doesn't seem to be the case. Putting a table into a dialog didn't seem to increase the table's refcount, and adding labels to the table didn't increase the refcnt of either the table or the labels. Could someone point me at a a place in the docs that tells me what gtk/gobject/gdk library functions impact the reference count? // Wally _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list