fix memleak
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 28 Aug 2005 19:29:05 +0000 (19:29 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 28 Aug 2005 19:29:05 +0000 (19:29 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1088 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h

index 29c874e1e6133b762d19ec0f40044883066082ad..564610a12bda8b9baf3a165356ee6c615cbe448e 100644 (file)
@@ -821,42 +821,6 @@ void open_traceset(GtkWidget * widget, gpointer user_data)
 
 }
 
-static void events_request_free(EventsRequest *events_request)
-{
-  if(events_request == NULL) return;
-
-  if(events_request->start_position != NULL)
-       lttv_traceset_context_position_destroy(events_request->start_position);
-  if(events_request->end_position != NULL)
-       lttv_traceset_context_position_destroy(events_request->end_position);
-  if(events_request->hooks != NULL)
-    g_array_free(events_request->hooks, TRUE);
-  if(events_request->before_chunk_traceset != NULL)
-       lttv_hooks_destroy(events_request->before_chunk_traceset);
-  if(events_request->before_chunk_trace != NULL)
-       lttv_hooks_destroy(events_request->before_chunk_trace);
-  if(events_request->before_chunk_tracefile != NULL)
-       lttv_hooks_destroy(events_request->before_chunk_tracefile);
-  if(events_request->event != NULL)
-       lttv_hooks_destroy(events_request->event);
-  if(events_request->event_by_id != NULL)
-       lttv_hooks_by_id_destroy(events_request->event_by_id);
-  if(events_request->after_chunk_tracefile != NULL)
-       lttv_hooks_destroy(events_request->after_chunk_tracefile);
-  if(events_request->after_chunk_trace != NULL)
-       lttv_hooks_destroy(events_request->after_chunk_trace);
-  if(events_request->after_chunk_traceset != NULL)
-       lttv_hooks_destroy(events_request->after_chunk_traceset);
-  if(events_request->before_request != NULL)
-       lttv_hooks_destroy(events_request->before_request);
-  if(events_request->after_request != NULL)
-       lttv_hooks_destroy(events_request->after_request);
-
-  g_free(events_request);
-}
-
-
-
 /* lttvwindow_process_pending_requests
  * 
  * This internal function gets called by g_idle, taking care of the pending
@@ -4202,6 +4166,10 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab,
   tab->viewer_container = gtk_vbox_new(TRUE, 2);
   tab->scrollbar = gtk_hscrollbar_new(NULL);
   //tab->multivpaned = gtk_multi_vpaned_new();
+  tab->time_window.start_time = ltt_time_zero;
+  tab->time_window.end_time = ltt_time_zero;
+  tab->time_window.time_width = ltt_time_zero;
+  tab->current_time = ltt_time_zero;
   
   gtk_box_pack_start(GTK_BOX(tab->vbox),
                      tab->viewer_container,
index 2cc2bf2c85a3ba7fd8ca0c8a707ef99178bf488a..cec78e036a071414d234dbcbe5a87bdf49f5f579 100644 (file)
@@ -897,7 +897,8 @@ void lttvwindow_events_request_remove_all(Tab       *tab,
     //if(events_request->servicing == TRUE) {
     //  lttv_hooks_call(events_request->after_request, NULL);
     //}
-    g_free(events_request);
+    events_request_free(events_request);
+    //g_free(events_request);
     tab->events_requests = g_slist_remove_link(tab->events_requests, element);
     element = g_slist_next(element);
     if(element == NULL) break;   /* end of list */
@@ -994,3 +995,46 @@ LttvTracesetContext* lttvwindow_get_traceset_context(Tab *tab)
 {
   return (LttvTracesetContext*)tab->traceset_info->traceset_context;
 }
+
+
+void events_request_free(EventsRequest *events_request)
+{
+  if(events_request == NULL) return;
+
+  if(events_request->start_position != NULL)
+       lttv_traceset_context_position_destroy(events_request->start_position);
+  if(events_request->end_position != NULL)
+       lttv_traceset_context_position_destroy(events_request->end_position);
+  if(events_request->hooks != NULL) {
+    guint i;
+    GArray *hooks = events_request->hooks;
+    for(i=0;i<hooks->len;i++) {
+      lttv_trace_hook_destroy(&g_array_index(hooks, LttvTraceHook, i));
+    }
+    g_array_free(events_request->hooks, TRUE);
+  }
+  if(events_request->before_chunk_traceset != NULL)
+       lttv_hooks_destroy(events_request->before_chunk_traceset);
+  if(events_request->before_chunk_trace != NULL)
+       lttv_hooks_destroy(events_request->before_chunk_trace);
+  if(events_request->before_chunk_tracefile != NULL)
+       lttv_hooks_destroy(events_request->before_chunk_tracefile);
+  if(events_request->event != NULL)
+       lttv_hooks_destroy(events_request->event);
+  if(events_request->event_by_id != NULL)
+       lttv_hooks_by_id_destroy(events_request->event_by_id);
+  if(events_request->after_chunk_tracefile != NULL)
+       lttv_hooks_destroy(events_request->after_chunk_tracefile);
+  if(events_request->after_chunk_trace != NULL)
+       lttv_hooks_destroy(events_request->after_chunk_trace);
+  if(events_request->after_chunk_traceset != NULL)
+       lttv_hooks_destroy(events_request->after_chunk_traceset);
+  if(events_request->before_request != NULL)
+       lttv_hooks_destroy(events_request->before_request);
+  if(events_request->after_request != NULL)
+       lttv_hooks_destroy(events_request->after_request);
+
+  g_free(events_request);
+}
+
+
index 4b856245a6f41c4d24a3d8731ee2751425d87610..1533ae240e7330ee4c9dc91078781b59542a1fa7 100644 (file)
@@ -239,8 +239,8 @@ FIXME : explain other important events
 */
 
 
-#ifndef VIEWER_H
-#define VIEWER_H
+#ifndef LTTVWINDOW_H
+#define LTTVWINDOW_H
 
 /*! \file lttvwindow.h
  * \brief API used by the graphical viewers to interact with their top window.
@@ -750,4 +750,7 @@ void set_time_window(Tab *tab, const TimeWindow *time_window);
 
 void set_current_time(Tab *tab, const LttTime *current_time);
 
-#endif //VIEWER_H
+
+void events_request_free(EventsRequest *events_request);
+
+#endif //LTTVWINDOW_H
This page took 0.028009 seconds and 4 git commands to generate.