trace: don't check random pointers for objects

Only see if the traced pointer is a GObject when it was registered with the
special offset of -2.
This commit is contained in:
Wim Taymans 2012-02-02 15:55:44 +01:00
parent e60b67f907
commit 5d6999f804
2 changed files with 9 additions and 6 deletions

View file

@ -205,7 +205,7 @@ gst_object_class_init (GstObjectClass * klass)
#ifndef GST_DISABLE_TRACE
_gst_object_trace =
_gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT), 0);
_gst_alloc_trace_register (g_type_name (GST_TYPE_OBJECT), -2);
#endif
gobject_class->set_property = gst_object_set_property;

View file

@ -168,15 +168,18 @@ gst_alloc_trace_print (const GstAllocTrace * trace)
gpointer data = mem_live->data;
const gchar *type_name;
if (G_IS_OBJECT (data)) {
type_name = G_OBJECT_TYPE_NAME (data);
} else if (trace->offset != -1) {
if (trace->offset == -2) {
if (G_IS_OBJECT (data))
type_name = G_OBJECT_TYPE_NAME (data);
else
type_name = "<invalid>";
} else if (trace->offset == -1) {
type_name = "<unknown>";
} else {
GType type;
type = G_STRUCT_MEMBER (GType, data, trace->offset);
type_name = g_type_name (type);
} else {
type_name = "";
}
g_print (" %-20.20s : %p\n", type_name, data);