From: compudj Date: Fri, 2 Jul 2004 16:10:08 +0000 (+0000) Subject: unref attribute should work better X-Git-Tag: v0.12.20~2872 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4d39be09fda397de58798c73a8273517767e3e93;p=lttv.git unref attribute should work better git-svn-id: http://ltt.polymtl.ca/svn@617 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/lttv/attribute.c b/ltt/branches/poly/lttv/lttv/attribute.c index db6fa6a6..0eef75b8 100644 --- a/ltt/branches/poly/lttv/lttv/attribute.c +++ b/ltt/branches/poly/lttv/lttv/attribute.c @@ -526,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)); } diff --git a/ltt/branches/poly/lttv/lttv/tracecontext.c b/ltt/branches/poly/lttv/lttv/tracecontext.c index cb9bd70a..dd52153f 100644 --- a/ltt/branches/poly/lttv/lttv/tracecontext.c +++ b/ltt/branches/poly/lttv/lttv/tracecontext.c @@ -638,8 +638,8 @@ guint lttv_process_traceset_middle(LttvTracesetContext *self, if(last_ret == TRUE || count >= nb_events || - (end_position!=NULL)?FALSE:lttv_traceset_context_ctx_pos_compare(self, - end_position) >= 0 || + ((end_position==NULL)?FALSE:(lttv_traceset_context_ctx_pos_compare(self, + end_position) >= 0))|| ltt_time_compare(tfc->timestamp, end) >= 0) { return count; @@ -880,12 +880,16 @@ void lttv_traceset_context_position_save(const LttvTracesetContext *self, pos->t_pos[iter_trace].tf_pos = g_new(LttEventPosition*, nb_tracefile); for(iter_tracefile = 0; iter_tracefile < nb_tracefile; iter_tracefile++) { - pos->t_pos[iter_trace].tf_pos[iter_tracefile] - = ltt_event_position_new(); tfc = tc->tracefiles[iter_tracefile]; event = tfc->e; - ltt_event_position(event, - pos->t_pos[iter_trace].tf_pos[iter_tracefile]); + if(event!=NULL) { + pos->t_pos[iter_trace].tf_pos[iter_tracefile] + = ltt_event_position_new(); + ltt_event_position(event, + pos->t_pos[iter_trace].tf_pos[iter_tracefile]); + } else { + pos->t_pos[iter_trace].tf_pos[iter_tracefile] = NULL; + } if(ltt_time_compare(tfc->timestamp, timestamp) < 0) timestamp = tfc->timestamp; } @@ -904,8 +908,8 @@ void lttv_traceset_context_position_destroy(LttvTracesetContextPosition *pos) for(iter_tracefile = 0; iter_tracefile < pos->t_pos[iter_trace].nb_tracefile; iter_tracefile++) { - - g_free(pos->t_pos[iter_trace].tf_pos[iter_tracefile]); + if(pos->t_pos[iter_trace].tf_pos[iter_tracefile] != NULL) + g_free(pos->t_pos[iter_trace].tf_pos[iter_tracefile]); } g_free(pos->t_pos[iter_trace].tf_pos); } @@ -930,9 +934,12 @@ void lttv_traceset_context_position_copy(LttvTracesetContextPosition *dest, for(iter_tracefile = 0; iter_tracefile < nb_tracefile; iter_tracefile++) { dest->t_pos[iter_trace].tf_pos[iter_tracefile] = ltt_event_position_new(); - ltt_event_position_copy( + if(src->t_pos[iter_trace].tf_pos[iter_tracefile] != NULL) + ltt_event_position_copy( dest->t_pos[iter_trace].tf_pos[iter_tracefile], src->t_pos[iter_trace].tf_pos[iter_tracefile]); + else + dest->t_pos[iter_trace].tf_pos[iter_tracefile] = NULL; } }