From d27948a397c1ff8a47b497ca07f5090c08e88628 Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 23 Aug 2005 15:31:26 +0000 Subject: [PATCH] main window quit remove loops before gtk_main_quit git-svn-id: http://ltt.polymtl.ca/svn@1060 04897980-b3bd-0310-b5e0-8ef037075253 --- .../gui/lttvwindow/lttvwindow/callbacks.c | 38 ++++++++++++------- .../gui/lttvwindow/lttvwindow/gtkdirsel.c | 1 - .../gui/lttvwindow/lttvwindow/init_module.c | 5 --- .../lttvwindow/lttvwindow/lttvwindowtraces.c | 8 +--- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index b126b85e..0f94bf44 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -331,6 +331,18 @@ static void connect_focus_recursive(GtkWidget *widget, (gpointer)viewer); } +/* Stop all the processings and call gtk_main_quit() */ +static void mainwindow_quit() +{ + lttvwindowtraces_unregister_requests(g_quark_from_string("stats")); + lttvwindowtraces_unregister_requests(g_quark_from_string("state")); + lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("stats")); + lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("state")); + + gtk_main_quit(); +} + + /* insert_viewer function constructs an instance of a viewer first, * then inserts the widget of the instance into the container of the * main window @@ -1735,21 +1747,19 @@ void add_trace(GtkWidget * widget, gpointer user_data) break; } get_absolute_pathname(dir, abs_path); - // Mathieu : modify to not share traces anymore : mmap uses so much less - // memory than a full buffer read... -// trace_v = lttvwindowtraces_get_trace_by_name(abs_path); -// if(trace_v == NULL) { + trace_v = lttvwindowtraces_get_trace_by_name(abs_path); + if(trace_v == NULL) { trace = ltt_trace_open(abs_path); if(trace == NULL) { g_warning("cannot open trace %s", abs_path); } else { trace_v = lttv_trace_new(trace); - //lttvwindowtraces_add_trace(trace_v); + lttvwindowtraces_add_trace(trace_v); lttvwindow_add_trace(tab, trace_v); } -// } else { -// lttvwindow_add_trace(tab, trace_v); -// } + } else { + lttvwindow_add_trace(tab, trace_v); + } gtk_widget_destroy((GtkWidget*)file_selector); @@ -1843,15 +1853,15 @@ void remove_trace(GtkWidget *widget, gpointer user_data) lttv_traceset_remove(traceset, index); lttv_trace_unref(trace_v); // Remove local reference -// if(lttv_trace_get_ref_number(trace_v) <= 1) { + if(lttv_trace_get_ref_number(trace_v) <= 1) { /* ref 1 : lttvwindowtraces only*/ ltt_trace_close(lttv_trace(trace_v)); /* lttvwindowtraces_remove_trace takes care of destroying * the traceset linked with the trace_v and also of destroying * the trace_v at the same time. */ -// lttvwindowtraces_remove_trace(trace_v); -// } + lttvwindowtraces_remove_trace(trace_v); + } tab->traceset_info->traceset_context = g_object_new(LTTV_TRACESET_STATS_TYPE, NULL); @@ -2366,7 +2376,7 @@ void on_quit_activate (GtkMenuItem *menuitem, gpointer user_data) { - gtk_main_quit (); + mainwindow_quit(); } @@ -3203,7 +3213,7 @@ on_MWindow_destroy (GtkWidget *widget, g_info("There are now : %d windows\n",g_slist_length(g_main_window_list)); if(g_slist_length(g_main_window_list) == 0) - gtk_main_quit (); + mainwindow_quit(); } gboolean @@ -3813,7 +3823,7 @@ char * get_selection(char ** loaded_module_name, int nb_module, } id = gtk_dialog_run(GTK_DIALOG(dialogue)); - GtkTreeModel **store_model = (GtkTreeModel*)store; + GtkTreeModel **store_model = (GtkTreeModel**)&store; switch(id){ case GTK_RESPONSE_ACCEPT: case GTK_RESPONSE_OK: diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/gtkdirsel.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/gtkdirsel.c index 801f5973..d6d6d44d 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/gtkdirsel.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/gtkdirsel.c @@ -3356,7 +3356,6 @@ attach_dir (CompletionDirSent *sent, cmpl_state->directory_storage = g_list_prepend (cmpl_state->directory_storage, new_dir); - new_dir->sent = sent; new_dir->fullname = g_strdup (dir_name); new_dir->fullname_len = strlen (dir_name); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c index 67c6a54e..42489de7 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/init_module.c @@ -243,11 +243,6 @@ static void destroy() { LttvTrace *trace; GSList *iter = NULL; - lttvwindowtraces_unregister_requests(g_quark_from_string("stats")); - lttvwindowtraces_unregister_requests(g_quark_from_string("state")); - lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("stats")); - lttvwindowtraces_unregister_computation_hooks(g_quark_from_string("state")); - lttv_option_remove("trace"); lttv_hooks_remove_data(main_hooks, window_creation_hook, NULL); diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c index 0bece47a..a37d1e39 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindowtraces.c @@ -80,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 */ @@ -880,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); -#if 0 /* 0.1 Lock traces */ { guint iter_trace=0; @@ -897,7 +896,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) } /* 0.2 Sync tracefiles */ lttv_process_traceset_synchronize_tracefiles(tsc); -#endif //0 /* 1. Before processing */ { /* if list_in is empty */ @@ -1214,10 +1212,9 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) } } } -#if 0 /* 4. Unlock traces */ { - //lttv_process_traceset_get_sync_data(tsc); + lttv_process_traceset_get_sync_data(tsc); guint iter_trace; for(iter_trace=0; @@ -1228,7 +1225,6 @@ gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace) lttvwindowtraces_unlock(trace_v); } } -#endif //0 return ret_val; } -- 2.34.1