Ethereal-dev: [Ethereal-dev] Patch for Service Response Time functions
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Lars.Roland@xxxxxxx
Date: Sun, 22 Jun 2003 03:01:40 +0200 (MEST)
Hello all, this patch fixes init_srt_table() for use with GTK2 . To prevent a crash, it is also necessary to display the top-level widget before calling init_srt_table(), because gdk_pixmap_create_from_xpm_d() needs it. There is also a note in main.c at line 2740 about this issue. Best Regards, Lars Roland
Index: ethereal/gtk/dcerpc_stat.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/dcerpc_stat.c,v
retrieving revision 1.10
diff -u -r1.10 dcerpc_stat.c
--- ethereal/gtk/dcerpc_stat.c 21 Jun 2003 09:50:19 -0000 1.10
+++ ethereal/gtk/dcerpc_stat.c 22 Jun 2003 00:10:22 -0000
@@ -222,13 +222,16 @@
gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
-
for(i=0,max_procs=0;procs[i].name;i++){
if(procs[i].num>max_procs){
max_procs=procs[i].num;
}
}
rs->num_procedures=max_procs+1;
+
+ /* We must display TOP LEVEL Widget before calling init_srt_table() */
+ gtk_widget_show(rs->win);
+
init_srt_table(&rs->srt_table, max_procs+1, vbox);
for(i=0;i<(max_procs+1);i++){
Index: ethereal/gtk/rpc_stat.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/rpc_stat.c,v
retrieving revision 1.11
diff -u -r1.11 rpc_stat.c
--- ethereal/gtk/rpc_stat.c 21 Jun 2003 09:50:19 -0000 1.11
+++ ethereal/gtk/rpc_stat.c 22 Jun 2003 00:10:23 -0000
@@ -223,12 +223,14 @@
gtk_box_pack_start(GTK_BOX(vbox), filter_label, FALSE, FALSE, 0);
gtk_widget_show(filter_label);
-
rpc_min_proc=-1;
rpc_max_proc=-1;
g_hash_table_foreach(rpc_procs, (GHFunc)rpcstat_find_procs, NULL);
rs->num_procedures=rpc_max_proc+1;
+ /* We must display TOP LEVEL Widget before calling init_srt_table() */
+ gtk_widget_show(rs->win);
+
init_srt_table(&rs->srt_table, rpc_max_proc+1, vbox);
for(i=0;i<rs->num_procedures;i++){
@@ -423,7 +425,7 @@
filter_entry=gtk_entry_new_with_max_length(250);
gtk_box_pack_start(GTK_BOX(filter_box), filter_entry, FALSE, FALSE, 0);
gtk_widget_show(filter_entry);
-
+
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
Index: ethereal/gtk/service_response_time_table.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/service_response_time_table.c,v
retrieving revision 1.4
diff -u -r1.4 service_response_time_table.c
--- ethereal/gtk/service_response_time_table.c 21 Jun 2003 06:45:49 -0000 1.4
+++ ethereal/gtk/service_response_time_table.c 22 Jun 2003 00:10:23 -0000
@@ -71,7 +71,7 @@
} else {
/* Columns 2-5 Count, Min, Max, Avg are sorted in descending
order by default.
- Columns 0 and 1 sort by ascending order by default
+ Columns 0 and 1 sort by ascending order by default
*/
if(column>=2){
clist->sort_type = GTK_SORT_DESCENDING;
@@ -106,7 +106,7 @@
return strcmp (text1, text2);
case 0:
case 2:
- i1=atoi(text1);
+ i1=atoi(text1);
i2=atoi(text2);
return i1-i2;
case 3:
@@ -121,7 +121,7 @@
return -1;
}
g_assert_not_reached();
- return 0;
+ return 0;
}
void
@@ -140,9 +140,11 @@
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(rst->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_box_pack_start(GTK_BOX(vbox), rst->scrolled_window, TRUE, TRUE, 0);
-
rst->table=(GtkCList *)gtk_clist_new(6);
+ gtk_widget_show(GTK_WIDGET(rst->table));
+ gtk_widget_show(rst->scrolled_window);
+
col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * 6);
win_style = gtk_widget_get_style(rst->scrolled_window);
ascend_pm = gdk_pixmap_create_from_xpm_d(rst->scrolled_window->window,
@@ -163,10 +165,10 @@
col_arrows[i].ascend_pm = gtk_pixmap_new(ascend_pm, ascend_bm);
gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
col_arrows[i].descend_pm = gtk_pixmap_new(descend_pm, descend_bm);
+ gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
if (i == 2) {
gtk_widget_show(col_arrows[i].descend_pm);
}
- gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_clist_set_column_widget(GTK_CLIST(rst->table), i, col_arrows[i].table);
gtk_widget_show(col_arrows[i].table);
}
@@ -192,7 +194,7 @@
SIGNAL_CONNECT(rst->table, "click-column", srt_click_column_cb, col_arrows);
- gtk_widget_show((GtkWidget *)rst->table);
+ gtk_widget_show(GTK_WIDGET(rst->table));
gtk_widget_show(rst->scrolled_window);
@@ -239,7 +241,7 @@
nstime_t delta;
rp=&rst->procedures[index];
-
+
/* calculate time delta between request and reply */
delta.secs=pinfo->fd->abs_secs-req_time->secs;
delta.nsecs=pinfo->fd->abs_usecs*1000-req_time->nsecs;
@@ -344,7 +346,7 @@
int i;
for(i=0;i<rst->num_procs;i++){
- rst->procedures[i].num=0;
+ rst->procedures[i].num=0;
rst->procedures[i].min.secs=0;
rst->procedures[i].min.nsecs=0;
rst->procedures[i].max.secs=0;
Index: ethereal/gtk/smb_stat.c
===================================================================
RCS file: /cvsroot/ethereal/gtk/smb_stat.c,v
retrieving revision 1.8
diff -u -r1.8 smb_stat.c
--- ethereal/gtk/smb_stat.c 21 Jun 2003 09:50:19 -0000 1.8
+++ ethereal/gtk/smb_stat.c 22 Jun 2003 00:10:24 -0000
@@ -170,6 +170,10 @@
label=gtk_label_new("SMB Commands");
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
+
+ /* We must display TOP LEVEL Widget before calling init_srt_table() */
+ gtk_widget_show(ss->win);
+
init_srt_table(&ss->smb_srt_table, 256, vbox);
for(i=0;i<256;i++){
init_srt_table_row(&ss->smb_srt_table, i, val_to_str(i, smb_cmd_vals, "Unknown(0x%02x)"));
- Follow-Ups:
- Re: [Ethereal-dev] Patch for Service Response Time functions
- From: Gerald Combs
- Re: [Ethereal-dev] Patch for Service Response Time functions
- Prev by Date: Re: [Ethereal-dev] patch for file.c
- Next by Date: Re: [Ethereal-dev] Patch for Service Response Time functions
- Previous by thread: RE : RE : [Ethereal-dev] about use command-line to add [NetworkmonitorDriver] to Dial-up network?
- Next by thread: Re: [Ethereal-dev] Patch for Service Response Time functions
- Index(es):





