Re: gobject reference question



Hi,

Boncek, John wrote:
More generally, what leak-detection tools exist?

-----Original Message-----
From: gtk-app-devel-list-bounces gnome org
[mailto:gtk-app-devel-list-bounces gnome org] On Behalf Of Wallace Owen
Sent: Monday, August 15, 2005 1:44 PM
To: gtk-app-devel-list gnome org
Subject: gobject reference question

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?

 // Wally
 
two suggestion:
1.) http://refdbg.sf.net
a ref-count debugger with gdb integration and so on

2.) in my unit tests I use:
gboolean g_object_checked_unref(GObject *obj)
{
  gpointer objref;
  g_object_add_weak_pointer((gpointer)obj,&objref);
  g_object_unref((gpointer)obj);
  return(objref == NULL);
}

I call this when unreffing an object which should have no further
references, thus is supposed to be destroyed.
It returns TRUE if that worked.

Stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]