diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-06-14 01:34:52 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-06-14 01:34:52 +0000 |
commit | 481c44b78b47a1d58ce846359971b784dfd44a6d (patch) | |
tree | 2a135ae7e4f3419069031f42727d7a36364a9f3c /ui/gtk/capture_file_dlg.c | |
parent | f6e2b64a8f276e7c24ae24788bae837f144313ed (diff) |
When stopping the capture before asking whether to save the results, run
the main loop until we're done reading the captured packets. Hopefully
this clears up bug 7318 in Evan Huus's case; I can't reproduce that
myself.
svn path=/trunk/; revision=43248
Diffstat (limited to 'ui/gtk/capture_file_dlg.c')
-rw-r--r-- | ui/gtk/capture_file_dlg.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index 6392412c56..5d77571c7a 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -977,6 +977,19 @@ file_merge_cmd_cb(GtkWidget *widget, gpointer data _U_) { file_merge_cmd(widget); } +static void +do_capture_stop(capture_file *cf) +{ + /* Stop the capture (complete with UI updates). */ + capture_stop_cb(NULL, NULL); + + /* Now run the main loop until the capture stops and we finish + reading it; we need to run the main loop so we respond to + messages on the sync pipe and the sync pipe being closed. */ + while (cf->state == FILE_READ_IN_PROGRESS) + gtk_main_iteration(); +} + gboolean do_file_close(capture_file *cf, gboolean from_quit, const char *before_what) { @@ -1094,7 +1107,7 @@ do_file_close(capture_file *cf, gboolean from_quit, const char *before_what) /* If there's a capture in progress, we have to stop the capture and then do the save. */ if (capture_in_progress) - capture_stop_cb(NULL, NULL); + do_capture_stop(cf); #endif /* Save the file and close it */ do_file_save(cf, TRUE); @@ -1105,7 +1118,7 @@ do_file_close(capture_file *cf, gboolean from_quit, const char *before_what) /* If there's a capture in progress; we have to stop the capture and then do the close. */ if (capture_in_progress) - capture_stop_cb(NULL, NULL); + do_capture_stop(cf); #endif /* Just close the file, discarding changes */ cf_close(cf); @@ -1130,7 +1143,7 @@ do_file_close(capture_file *cf, gboolean from_quit, const char *before_what) /* If there's a capture in progress, we have to stop the capture and then do the close. */ if (capture_in_progress) - capture_stop_cb(NULL, NULL); + do_capture_stop(cf); #endif cf_close(cf); } |