main window quit remove loops before gtk_main_quit
[lttv.git] / ltt / branches / poly / lttv / modules / gui / lttvwindow / lttvwindow / lttvwindowtraces.c
index 7e83fc30a22aa6065dfd457b7ab13e7f55bf8eb7..a37d1e398b2506b9c9943fcd90fb632139fcec5e 100644 (file)
 
 /* Here is the implementation of the API */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <string.h>
 
 #include <ltt/time.h>
 #include <ltt/trace.h>
@@ -65,7 +70,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace);
 
 LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path)
 {
-  LttvAttribute *attribute = lttv_global_attributes();
   guint i;
 
   for(i=0;i<lttvwindowtraces_get_number();i++) {
@@ -76,7 +80,7 @@ LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path)
 
     trace = lttv_trace(trace_v);
     g_assert(trace != NULL);
-    name = ltt_trace_name(trace);
+    name = g_quark_to_string(ltt_trace_name(trace));
 
     if(strcmp(name, path) == 0) {
       /* Found */
@@ -136,13 +140,13 @@ void lttvwindowtraces_add_trace(LttvTrace *trace)
   struct stat buf;
   gchar attribute_path[PATH_MAX];
 
-  if(stat(ltt_trace_name(lttv_trace(trace)), &buf)) {
+  if(stat(g_quark_to_string(ltt_trace_name(lttv_trace(trace))), &buf)) {
     g_warning("lttvwindowtraces_add_trace: Trace %s not found",
-        ltt_trace_name(lttv_trace(trace)));
+        g_quark_to_string(ltt_trace_name(lttv_trace(trace))));
     return;
   }
   g_assert(
-      snprintf(attribute_path, PATH_MAX, "%lu:%lu", buf.st_dev, buf.st_ino) >= 0);
+      snprintf(attribute_path, PATH_MAX, "%llu:%llu", buf.st_dev, buf.st_ino) >= 0);
   
   g_assert(attribute = 
       LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
@@ -220,7 +224,7 @@ void lttvwindowtraces_remove_trace(LttvTrace *trace)
       /* Found */
       LttvAttribute *l_attribute;
 
-      /* create new traceset and tracesetcontext */
+      /* destroy traceset and tracesetcontext */
       LttvTraceset *ts;
       LttvTracesetStats *tss;
       
@@ -255,9 +259,10 @@ void lttvwindowtraces_remove_trace(LttvTrace *trace)
       g_object_unref(tss);
       lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
                                      LTTV_COMPUTATION_TRACESET_CONTEXT);
-      lttv_traceset_destroy(ts);
       lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
                                      LTTV_COMPUTATION_TRACESET);
+      /* Destroy the traceset and the trace also */
+      lttv_traceset_destroy(ts);
 
       /* finally, remove the global attribute */
       lttv_attribute_remove(attribute, i);
@@ -828,7 +833,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
   LttvAttributeValue value;
   LttvAttributeType type;
   gboolean ret_val;
-  LttvHooks *before_request, *after_request;
 
   if(trace == NULL)
     return FALSE;
@@ -876,7 +880,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
  
   /* There is no events requests pending : we should never have been called! */
   g_assert(g_slist_length(*list_out) != 0 || g_slist_length(*list_in) != 0);
-
   /* 0.1 Lock traces */
   {
     guint iter_trace=0;
@@ -893,7 +896,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
   }
   /* 0.2 Sync tracefiles */
   lttv_process_traceset_synchronize_tracefiles(tsc);
-
   /* 1. Before processing */
   {
     /* if list_in is empty */
@@ -956,7 +958,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
                                              &value);
           g_assert(type == LTTV_POINTER);
           LttvHooks *before_request = (LttvHooks*)*(value.v_pointer);
-
  
           if(before_request != NULL) lttv_hooks_call(before_request, tsc);
           
@@ -1023,7 +1024,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
   /* 2. call process traceset middle for a chunk */
   {
     /*(assert list_in is not empty! : should not even be called in that case)*/
-    LttTime end = { G_MAXUINT, G_MAXUINT };
+    LttTime end = ltt_time_infinite;
     g_assert(g_slist_length(*list_in) != 0);
     
     lttv_process_traceset_middle(tsc, end, CHUNK_NUM_EVENTS, NULL);
@@ -1213,7 +1214,7 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
   }
   /* 4. Unlock traces */
   {
-    //lttv_process_traceset_get_sync_data(tsc);
+    lttv_process_traceset_get_sync_data(tsc);
     guint iter_trace;
     
     for(iter_trace=0; 
This page took 0.024968 seconds and 4 git commands to generate.