diff options
author | Gerald Combs <gerald@wireshark.org> | 2015-05-22 12:57:44 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-05-22 20:05:04 +0000 |
commit | e9d8769d5b3bf16e0820f727a39abeee5430e2db (patch) | |
tree | 43f8e8b173bad8b2e49f6ad58c19e5bd8d6adac0 /ui | |
parent | a34d696377afc2b4eaee5710c385292da613510c (diff) |
Qt: Don't crash after "Save As".
Rename "stay_closed" to "dont_reopen" to match cf_save_records and its
GTK+ equivalent. Set "dont_reopen" to FALSE when we "Save As", otherwise
we crash on Windows.
Bug: 10904
Change-Id: I4bb10abc230439e10cc55ffbd5595bfbc0a34b6f
Reviewed-on: https://code.wireshark.org/review/8592
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/main_window.cpp | 12 | ||||
-rw-r--r-- | ui/qt/main_window.h | 4 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 3d4702f67a..a9681306ee 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -832,7 +832,7 @@ void MainWindow::importCaptureFile() { openCaptureFile(import_dlg.capfileName()); } -void MainWindow::saveCaptureFile(capture_file *cf, bool stay_closed) { +void MainWindow::saveCaptureFile(capture_file *cf, bool dont_reopen) { QString file_name; gboolean discard_comments; @@ -844,7 +844,7 @@ void MainWindow::saveCaptureFile(capture_file *cf, bool stay_closed) { probably pcap-ng, which supports comments and, if it's not pcap-ng, let the user decide what they want to do if they've added comments. */ - saveAsCaptureFile(cf, FALSE, stay_closed); + saveAsCaptureFile(cf, FALSE, dont_reopen); } else { if (cf->unsaved_changes) { cf_write_status_t status; @@ -879,7 +879,7 @@ void MainWindow::saveCaptureFile(capture_file *cf, bool stay_closed) { support comments, and the user said not to delete the comments. Do a "Save As" so the user can select one of those formats and choose a file name. */ - saveAsCaptureFile(cf, TRUE, stay_closed); + saveAsCaptureFile(cf, TRUE, dont_reopen); return; case CANCELLED: @@ -899,7 +899,7 @@ void MainWindow::saveCaptureFile(capture_file *cf, bool stay_closed) { so make a copy and free it later. */ file_name = cf->filename; status = cf_save_records(cf, file_name.toUtf8().constData(), cf->cd_t, cf->iscompressed, - discard_comments, stay_closed); + discard_comments, dont_reopen); switch (status) { case CF_WRITE_OK: @@ -929,7 +929,7 @@ void MainWindow::saveCaptureFile(capture_file *cf, bool stay_closed) { } } -void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments, bool stay_closed) { +void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments, bool dont_reopen) { QString file_name = ""; int file_type; gboolean compressed; @@ -1014,7 +1014,7 @@ void MainWindow::saveAsCaptureFile(capture_file *cf, bool must_support_comments, /* Attempt to save the file */ status = cf_save_records(cf, file_name.toUtf8().constData(), file_type, compressed, - discard_comments, stay_closed); + discard_comments, dont_reopen); switch (status) { case CF_WRITE_OK: diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index eab44a4e57..6ca0c9dafe 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -152,8 +152,8 @@ private: void mergeCaptureFile(); void importCaptureFile(); - void saveCaptureFile(capture_file *cf, bool stay_closed); - void saveAsCaptureFile(capture_file *cf, bool must_support_comments, bool stay_closed); + void saveCaptureFile(capture_file *cf, bool dont_reopen); + void saveAsCaptureFile(capture_file *cf, bool must_support_comments = false, bool dont_reopen = false); void exportSelectedPackets(); void exportDissections(export_type_e export_type); diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 22a94563ee..d265066a58 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1517,7 +1517,7 @@ void MainWindow::on_actionFileSave_triggered() void MainWindow::on_actionFileSaveAs_triggered() { - saveAsCaptureFile(capture_file_.capFile(), FALSE, TRUE); + saveAsCaptureFile(capture_file_.capFile()); } void MainWindow::on_actionFileSetListFiles_triggered() |