diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-06-13 20:02:46 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-06-23 07:58:29 +0000 |
commit | 2c8056acdf267c8e36fdfb6a3af286972d27f655 (patch) | |
tree | 7f57f1f47bdde0070cbdffe009e9cb5e5a704032 /ui/qt/main_window_slots.cpp | |
parent | bf29a5cdea83ffe30f957dc9432c9e54b1db6e19 (diff) | |
download | wireshark-2c8056acdf267c8e36fdfb6a3af286972d27f655.tar.gz |
Qt: quit the UI if WIRESHARK_QUIT_AFTER_CAPTURE is set (offline mode too).
This change is useful to use the offline mode in tests (like fuzzing)
that require the software to quit after the processing of a sample.
Change-Id: I311c642edecf4012dc518c2bf8bca66c97aa1b02
Reviewed-on: https://code.wireshark.org/review/16038
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/main_window_slots.cpp')
-rw-r--r-- | ui/qt/main_window_slots.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 1bd54ce9d1..38a441b1a7 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -178,6 +178,7 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned gchar *err_msg; int err; gboolean name_param; + gboolean ret = true; // was a file name given as function parameter? name_param = !cf_path.isEmpty(); @@ -190,13 +191,15 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned if (open_dlg.open(file_name, type)) { cf_path = file_name; } else { - return false; + ret = false; + goto finish; } } QString before_what(tr(" before opening another file")); if (!testCaptureFileClose(before_what)) { - return false; + ret = false; + goto finish; } if (dfilter_compile(read_filter.toUtf8().constData(), &rfcode, &err_msg)) { @@ -249,7 +252,8 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned string and return (without changing the last containing directory). */ capture_file_.setCapFile(NULL); - return false; + ret = false; + goto finish; } break; } @@ -258,7 +262,10 @@ bool MainWindow::openCaptureFile(QString cf_path, QString read_filter, unsigned main_ui_->statusBar->showExpert(); - return true; +finish: + if (global_capture_opts.quit_after_cap) + exit(0); + return ret; } void MainWindow::filterPackets(QString new_filter, bool force) |