aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-07-26 10:34:07 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-07-26 10:34:07 +0000
commit246954a14c67446bb039db098083d3ed4995134e (patch)
tree07d43495da74cf1d799a0ebb9ebd17839cace836
parent9221a4370e73cb1efd4ddf1122a56e077cd5db2a (diff)
From Kovarththanan Rajaratnam:
Only clear packet list store if we need to redissect. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29195 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--file.c7
-rw-r--r--gtk/new_packet_list.c9
-rw-r--r--gtk/packet_list_store.c26
-rw-r--r--gtk/packet_list_store.h1
-rw-r--r--ui_util.h1
5 files changed, 44 insertions, 0 deletions
diff --git a/file.c b/file.c
index 2230af52bf..b8b33d383b 100644
--- a/file.c
+++ b/file.c
@@ -362,6 +362,7 @@ cf_reset_state(capture_file *cf)
/* Clear the packet list. */
#ifdef NEW_PACKET_LIST
new_packet_list_freeze();
+ new_packet_list_clear();
new_packet_list_thaw();
#else
packet_list_freeze();
@@ -1635,6 +1636,12 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
/* Initialize all data structures used for dissection. */
init_dissection();
+
+#ifdef NEW_PACKET_LIST
+ /* We need to redissect the packets so we have to discard our old
+ * packet list store. */
+ new_packet_list_clear();
+#endif
}
/* Freeze the packet list while we redo it, so we don't get any
diff --git a/gtk/new_packet_list.c b/gtk/new_packet_list.c
index f2f085db37..9d9d1711b8 100644
--- a/gtk/new_packet_list.c
+++ b/gtk/new_packet_list.c
@@ -172,6 +172,15 @@ create_view_and_model(void)
}
void
+new_packet_list_clear(void)
+{
+ packet_history_clear();
+
+ new_packet_list_store_clear(packetlist);
+ gtk_widget_queue_draw(packetlist->view);
+}
+
+void
new_packet_list_freeze(void)
{
/* So we don't lose the model by the time we want to thaw it */
diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c
index 5464c74de9..656131e300 100644
--- a/gtk/packet_list_store.c
+++ b/gtk/packet_list_store.c
@@ -517,6 +517,32 @@ new_packet_list_new(void)
}
void
+new_packet_list_store_clear(PacketList *packet_list)
+{
+ GtkTreePath *path;
+ guint i;
+
+ g_return_if_fail(packet_list != NULL);
+ g_return_if_fail(PACKETLIST_IS_LIST(packet_list));
+
+ if(packet_list->num_rows == 0)
+ return;
+
+ path = gtk_tree_path_new();
+
+ for(i = 0; i < packet_list->num_rows; ++i) {
+ gtk_tree_model_row_deleted(GTK_TREE_MODEL(packet_list), path);
+ }
+
+ gtk_tree_path_free(path);
+
+ /* XXX - hold on to these rows and reuse them instead */
+ g_free(packet_list->rows);
+ packet_list->rows = NULL;
+ packet_list->num_rows = 0;
+}
+
+void
packet_list_append_record(PacketList *packet_list, row_data_t *row_data)
{
GtkTreeIter iter;
diff --git a/gtk/packet_list_store.h b/gtk/packet_list_store.h
index 3262ac6b93..c9389abad9 100644
--- a/gtk/packet_list_store.h
+++ b/gtk/packet_list_store.h
@@ -89,6 +89,7 @@ struct _PacketListClass
GType packet_list_list_get_type(void);
PacketList *new_packet_list_new(void);
+void new_packet_list_store_clear(PacketList *packet_list);
void packet_list_append_record(PacketList *packet_list, row_data_t *row_data);
#endif /* NEW_PACKET_LIST */
diff --git a/ui_util.h b/ui_util.h
index 7e39c649c4..b650595942 100644
--- a/ui_util.h
+++ b/ui_util.h
@@ -59,6 +59,7 @@ extern void pipe_input_set_handler(gint source, gpointer user_data, int *child_p
/* packet_list.c */
#ifdef NEW_PACKET_LIST
+void new_packet_list_clear(void);
void new_packet_list_freeze(void);
void new_packet_list_thaw(void);
void new_packet_list_next(void);