unref attribute should work better
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 2 Jul 2004 16:10:08 +0000 (16:10 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 2 Jul 2004 16:10:08 +0000 (16:10 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@617 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/lttv/attribute.c
ltt/branches/poly/lttv/lttv/tracecontext.c

index db6fa6a6396ace93e02f2140db03022d1b719ac2..0eef75b80474263f1baa9e9fa0d6c5be2eeba13d 100644 (file)
@@ -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;i<self->attributes->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));
 }
 
 
index cb9bd70a79f65fbf4710e2220d5808784ee96eb8..dd52153f589ed6454141f3036c6f6bcf427087bf 100644 (file)
@@ -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;
     }
   }
 
This page took 0.025472 seconds and 4 git commands to generate.