aboutsummaryrefslogtreecommitdiffstats
path: root/proto_hier_stats.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-10-27 06:45:37 +0000
committerGuy Harris <guy@alum.mit.edu>2005-10-27 06:45:37 +0000
commit0203c65739ed0f814daa513731838e722e6b3cfa (patch)
tree6f6114bf89e82abb916114bf11f7cb53eeb20f3e /proto_hier_stats.c
parent3e0e3011e28a28944a2ca452921f3162eadc1c5f (diff)
Check on every iteration of a loop whether to pop up a dialog box,
rather than checking only on every progress bar update quantum, so that if the update quantum is *very* large, we don't end up waiting longer than the standard time for a dialog box before checking. svn path=/trunk/; revision=16327
Diffstat (limited to 'proto_hier_stats.c')
-rw-r--r--proto_hier_stats.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/proto_hier_stats.c b/proto_hier_stats.c
index f1e0d87ef1..bf67fecf88 100644
--- a/proto_hier_stats.c
+++ b/proto_hier_stats.c
@@ -208,6 +208,17 @@ ph_stats_new(void)
tot_bytes = 0;
for (frame = cfile.plist; frame != NULL; frame = frame->next) {
+ /* Create the progress bar if necessary.
+ We check on every iteration of the loop, so that
+ it takes no longer than the standard time to create
+ it (otherwise, for a large file, we might take
+ considerably longer than that standard time in order
+ to get to the next progress bar step). */
+ if (progbar == NULL)
+ progbar = delayed_create_progress_dlg(
+ "Computing", "protocol hierarchy statistics",
+ &stop_flag, &start_time, prog_val);
+
/* Update the progress bar, but do it only N_PROGBAR_UPDATES
times; when we update it, we have to run the GTK+ main
loop to get it to repaint what's pending, and doing so
@@ -222,12 +233,6 @@ ph_stats_new(void)
prog_val = (gfloat) count / cfile.count;
- if (progbar == NULL)
- /* Create the progress bar if necessary */
- progbar = delayed_create_progress_dlg(
- "Computing", "protocol hierarchy statistics",
- &stop_flag, &start_time, prog_val);
-
if (progbar != NULL) {
g_snprintf(status_str, sizeof(status_str),
"%4u of %u frames", count, cfile.count);