diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2005-02-27 13:57:45 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2005-02-27 13:57:45 +0000 |
commit | a33f8ebbadf8a1834e72169feb435f638d0f0233 (patch) | |
tree | 42d18a170b32c5ef6170ba87d8358c6c226f3308 /gtk/sctp_stat_dlg.c | |
parent | b8ba4f9180e61aa4f2dc64d3c12a5ea6e4417c0d (diff) |
few fixes to The SCTP associations dialog
- do not call main_filter_packets() with a null dfilter string
- fix two leaks
svn path=/trunk/; revision=13531
Diffstat (limited to 'gtk/sctp_stat_dlg.c')
-rw-r--r-- | gtk/sctp_stat_dlg.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gtk/sctp_stat_dlg.c b/gtk/sctp_stat_dlg.c index 3cbdaac2d9..68e5a0d818 100644 --- a/gtk/sctp_stat_dlg.c +++ b/gtk/sctp_stat_dlg.c @@ -52,6 +52,7 @@ static sctp_assoc_info_t* selected_stream = NULL; /* current selection */ extern GtkWidget *main_display_filter_widget; static sctp_allassocs_info_t *sctp_assocs=NULL; static guint16 n_children=0; +static GtkWidget *bt_afilter = NULL; #define NUM_COLS 7 #define FRAME_LIMIT 8 @@ -133,6 +134,13 @@ static void add_to_clist(sctp_assoc_info_t* assinfo) static void sctp_stat_on_unselect(GtkButton *button _U_, gpointer user_data _U_) { + if (filter_string != NULL) { + g_free(filter_string); + filter_string = NULL; + } + + selected_stream = NULL; + gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), ""); gtk_clist_unselect_all(GTK_CLIST(clist)); } @@ -203,7 +211,9 @@ sctp_assoc_info_t* assoc; static void sctp_stat_on_apply_filter (GtkButton *button _U_, gpointer user_data _U_) { - main_filter_packets(&cfile, filter_string, FALSE); + if (filter_string != NULL) { + main_filter_packets(&cfile, filter_string, FALSE); + } } static void @@ -217,8 +227,10 @@ GString *gstring=NULL; struct sockaddr_in *infosrc=NULL; struct sockaddr_in *infodst=NULL; - if (selected_stream==NULL) + if (selected_stream==NULL) { + gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), ""); return; + } if (selected_stream->n_packets>FRAME_LIMIT) { @@ -302,6 +314,7 @@ struct sockaddr_in *infodst=NULL; str = g_strdup_printf(")))"); g_string_append(gstring, str); filter_string = gstring->str; + g_string_free(gstring,FALSE); } } else @@ -318,8 +331,14 @@ struct sockaddr_in *infodst=NULL; list = g_list_next(list); } filter_string = gstring->str; + g_string_free(gstring,FALSE); + } + + if (filter_string != NULL) { + gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string); + } else { + g_assert_not_reached(); } - gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string); } @@ -409,7 +428,7 @@ GtkWidget *vbox1; GtkWidget *scrolledwindow1; GtkWidget *hbuttonbox2; GtkWidget *bt_unselect; -GtkWidget *bt_filter, *bt_afilter; +GtkWidget *bt_filter; GtkWidget *bt_close; GtkWidget *bt_analyse; |