aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-11-16 16:27:34 -0800
committerPascal Quantin <pascal.quantin@gmail.com>2015-11-17 09:40:39 +0000
commit7518a74dbb32f941509a5dcabb5f74a3af14985d (patch)
treeaaf4777c792f2f9f0b33e35cf21519b7eb456292
parent622603b277043bca649e4a370af252bb4802181c (diff)
Qt: Fix a merge crash.
Update the logic in ui/qt/main_window.cpp:mergeCaptureFile to match ui/gtk/capture_file_dlg.c:file_merge_cmd. This ensures that we don't try to use a stale (and freed) read filter. Call cf_set_rfcode in both. Bug: 11718 Change-Id: I6da65e428bff39e907f45992bac7337880c02ce9 Reviewed-on: https://code.wireshark.org/review/11895 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--ui/gtk/capture_file_dlg.c2
-rw-r--r--ui/qt/main_window.cpp6
2 files changed, 3 insertions, 5 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index c93d5a6b36..e120034751 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -1005,7 +1005,7 @@ file_merge_cmd(GtkWidget *w _U_)
/* Attach the new read filter to "cf" ("cf_open()" succeeded, so
it closed the previous capture file, and thus destroyed any
previous read filter attached to "cf"). */
- cfile.rfcode = rfcode;
+ cf_set_rfcode(&cfile, rfcode);
switch (cf_read(&cfile, FALSE)) {
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 3918f47575..822b47f0a9 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -962,9 +962,7 @@ void MainWindow::mergeCaptureFile()
if (merge_dlg.merge(file_name)) {
gchar *err_msg;
- if (dfilter_compile(read_filter.toUtf8().constData(), &rfcode, &err_msg)) {
- cf_set_rfcode(capture_file_.capFile(), rfcode);
- } else {
+ if (!dfilter_compile(read_filter.toUtf8().constData(), &rfcode, &err_msg)) {
/* Not valid. Tell the user, and go back and run the file
selection box again once they dismiss the alert. */
//bad_dfilter_alert_box(top_level, read_filter->str);
@@ -1025,7 +1023,7 @@ void MainWindow::mergeCaptureFile()
/* Attach the new read filter to "cf" ("cf_open()" succeeded, so
it closed the previous capture file, and thus destroyed any
previous read filter attached to "cf"). */
- CaptureFile::globalCapFile()->rfcode = rfcode;
+ cf_set_rfcode(CaptureFile::globalCapFile(), rfcode);
switch (cf_read(CaptureFile::globalCapFile(), FALSE)) {