aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-04-06 15:16:04 -0700
committerGuy Harris <guy@alum.mit.edu>2019-04-06 23:22:06 +0000
commit4c8a226c075732f83e77757ccaff31f32d92f9e8 (patch)
tree9bf8f79ec97e1afc5a37e666a0011b141879ee7b /file.c
parent6636fa3416c0a1cc346b9610d160a20a11530f08 (diff)
Explicitly make cf->{rec,buf} the information for the selected packet.
Move it next to other capture_file fields for the currently-selected packet, add a comment indicating that's what all those fields are for, separate them from the following fields that *aren't* for the currently-selected field, and explicitly use them in cf_select_packet(). Also add a comment about why we're waiting until the end to free up the old cf->edt in cf_select_packet() and cf_unselect_packet(). Change-Id: I1653af06eeb4ebe1131bc08bcaa2dc639932c7fa Ping-Bug: 15683 Reviewed-on: https://code.wireshark.org/review/32764 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'file.c')
-rw-r--r--file.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/file.c b/file.c
index a74ff6522a..227b41f13a 100644
--- a/file.c
+++ b/file.c
@@ -3812,7 +3812,7 @@ cf_select_packet(capture_file *cf, int row)
}
/* Get the data in that frame. */
- if (!cf_read_record (cf, fdata)) {
+ if (!cf_read_record_r(cf, fdata, &cf->rec, &cf->buf)) {
return;
}
@@ -3820,6 +3820,25 @@ cf_select_packet(capture_file *cf, int row)
cf->current_frame = fdata;
cf->current_row = row;
+ /*
+ * The change to defer freeing the current epan_dissect_t was in
+ * commit a2bb94c3b33d53f42534aceb7cc67aab1d1fb1f9; to quote
+ * that commit's comment:
+ *
+ * Clear GtkTreeStore before freeing edt
+ *
+ * When building current data for packet details treeview we store two
+ * things.
+ * - Generated string with item label
+ * - Pointer to node field_info structure
+ *
+ * After epan_dissect_{free, cleanup} pointer to field_info node is no
+ * longer valid so we should clear GtkTreeStore before freeing.
+ *
+ * XXX - we're no longer using GTK+; is there a way to ensure that
+ * *nothing* refers to any of the current frame information before
+ * we replace it?
+ */
old_edt = cf->edt;
/* Create the logical protocol tree. */
/* We don't need the columns here. */
@@ -3834,7 +3853,6 @@ cf_select_packet(capture_file *cf, int row)
if (old_edt != NULL)
epan_dissect_free(old_edt);
-
}
/* Unselect the selected packet, if any. */
@@ -3843,6 +3861,10 @@ cf_unselect_packet(capture_file *cf)
{
epan_dissect_t *old_edt = cf->edt;
+ /*
+ * See the comment in cf_select_packet() about deferring the freeing
+ * of the old cf->edt.
+ */
cf->edt = NULL;
/* No packet is selected. */