Ethereal-dev: [Ethereal-dev] incorrect displayed packets bug

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Brett Kuskie" <mstrprgmmr@xxxxxxxx>
Date: 20 Dec 2004 15:11:57 -0000
This patch fixes a bug where the displayed packets in all the 'export' dialog windows is incorrect.

This can be reproduced in 0.10.8 by opening a capture file with an empty filter.
Then open any of the export dialog windows and cancel it.
Apply a filter that changes the number of packets being displayed,
then open the same export dialog window and the displayed packets count is the same as before the filter was applied.

This patch makes all the ranges get recalculated every time an export dialog is opened, not just the first time.

Brett Kuskie



--- ethereal-0.10.8/gtk/print_dlg.c	2004-12-14 12:52:41.000000000 -0700
+++ ethereal-0.10.8_mod/gtk/print_dlg.c	2004-12-20 07:58:03.000000000 -0700
@@ -132,10 +132,10 @@
       args->print_dissections   = print_dissections_as_displayed;
       args->print_hex           = FALSE;
       args->print_formfeed      = FALSE;
-  
-      /* init the printing range */
-      packet_range_init(&args->range);
   }
+  
+  /* init the printing range */
+  packet_range_init(&args->range);
 
   print_win = open_print_dialog("Ethereal: Print", output_action_print, args);
   SIGNAL_CONNECT(print_win, "destroy", print_destroy_cb, &print_win);
@@ -176,10 +176,10 @@
       args->print_dissections   = print_dissections_as_displayed;
       args->print_hex           = FALSE;
       args->print_formfeed      = FALSE;
-  
-      /* init the printing range */
-      packet_range_init(&args->range);
   }
+  
+  /* init the printing range */
+  packet_range_init(&args->range);
 
   export_text_win = open_print_dialog("Ethereal: Export as \"Plain Text\" File", output_action_export_text, args);
   SIGNAL_CONNECT(export_text_win, "destroy", print_destroy_cb, &export_text_win);
@@ -220,10 +220,10 @@
       args->print_dissections   = print_dissections_as_displayed;
       args->print_hex           = FALSE;
       args->print_formfeed      = FALSE;
-  
-      /* init the printing range */
-      packet_range_init(&args->range);
   }
+  
+  /* init the printing range */
+  packet_range_init(&args->range);
 
   export_ps_win = open_print_dialog("Ethereal: Export as \"PostScript\" file", output_action_export_ps, args);
   SIGNAL_CONNECT(export_ps_win, "destroy", print_destroy_cb, &export_ps_win);
@@ -264,10 +264,10 @@
       args->print_dissections   = print_dissections_as_displayed;
       args->print_hex           = FALSE;
       args->print_formfeed      = FALSE;
-  
-      /* init the printing range */
-      packet_range_init(&args->range);
   }
+  
+  /* init the printing range */
+  packet_range_init(&args->range);
 
   export_psml_win = open_print_dialog("Ethereal: Export as \"PSML\" file", output_action_export_psml, args);
   SIGNAL_CONNECT(export_psml_win, "destroy", print_destroy_cb, &export_psml_win);
@@ -308,10 +308,10 @@
       args->print_dissections   = print_dissections_as_displayed;
       args->print_hex           = FALSE;
       args->print_formfeed      = FALSE;
-  
-      /* init the printing range */
-      packet_range_init(&args->range);
   }
+  
+  /* init the printing range */
+  packet_range_init(&args->range);
 
   export_pdml_win = open_print_dialog("Ethereal: Export as \"PDML\" file", output_action_export_pdml, args);
   SIGNAL_CONNECT(export_pdml_win, "destroy", print_destroy_cb, &export_pdml_win);