X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fattribute.c;h=0eef75b80474263f1baa9e9fa0d6c5be2eeba13d;hb=3710295e1cd7cd1d4ec53bd4950f0f078914b7e0;hp=8088f3ba0901a53a7617853390a857d67ad23f10;hpb=5bf80c50db66957caea1577bb4c9f8e8f7d9d75e;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/attribute.c b/ltt/branches/poly/lttv/lttv/attribute.c index 8088f3ba..0eef75b8 100644 --- a/ltt/branches/poly/lttv/lttv/attribute.c +++ b/ltt/branches/poly/lttv/lttv/attribute.c @@ -161,6 +161,10 @@ lttv_attribute_remove(LttvAttribute *self, unsigned i) a = &g_array_index(self->attributes, Attribute, i); + /* If the element is a gobject, unreference it. */ + if(a->type == LTTV_GOBJECT && a->value.dv_gobject != NULL) + g_object_unref(a->value.dv_gobject); + /* Remove the array element and its entry in the name index */ g_hash_table_remove(self->names, GUINT_TO_POINTER(a->name)); @@ -234,7 +238,7 @@ lttv_attribute_find(LttvAttribute *self, LttvAttributeName name, } -void lttv_attribute_recursive_free(LttvAttribute *self) +/*void lttv_attribute_recursive_free(LttvAttribute *self) { int i, nb; @@ -249,7 +253,7 @@ void lttv_attribute_recursive_free(LttvAttribute *self) } } g_object_unref(self); -} +}*/ void lttv_attribute_recursive_add(LttvAttribute *dest, LttvAttribute *src) @@ -272,7 +276,7 @@ void lttv_attribute_recursive_add(LttvAttribute *dest, LttvAttribute *src) else { g_assert(lttv_attribute_find(dest, a->name, a->type, &value)); switch(a->type) { - case LTTV_INT: + case LTTV_INT: *value.v_int += a->value.dv_int; break; case LTTV_UINT: @@ -506,6 +510,7 @@ attribute_interface_init (gpointer g_iface, gpointer iface_data) klass->find_subdir = (LttvIAttribute* (*) (LttvIAttribute *self, LttvAttributeName name)) lttv_attribute_find_subdir; + } @@ -521,11 +526,15 @@ attribute_instance_init (GTypeInstance *instance, gpointer g_class) static void attribute_finalize (LttvAttribute *self) { - g_hash_table_destroy(self->names); + guint i; g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "attribute_finalize()"); + + for(i=0;iattributes->len;i++) { + lttv_attribute_remove(self, i); + } + + g_hash_table_destroy(self->names); g_array_free(self->attributes, TRUE); - G_OBJECT_CLASS(g_type_class_peek_parent( - g_type_class_peek(LTTV_ATTRIBUTE_TYPE)))->finalize(G_OBJECT(self)); }