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>
This commit is contained in:
Gerald Combs 2015-05-22 12:57:44 -07:00
parent a34d696377
commit e9d8769d5b
3 changed files with 9 additions and 9 deletions

View File

@ -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:

View File

@ -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);

View File

@ -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()