diff options
author | Anders Broman <anders.broman@ericsson.com> | 2009-07-29 21:32:49 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2009-07-29 21:32:49 +0000 |
commit | 3ec8398f169380b57b1cecfb69453687935e7060 (patch) | |
tree | eaf3e95481a55c6f343aaa444d996e463f3c2619 | |
parent | 26d1dfcf4caa702a38737a0768375cb0b1e89ace (diff) |
From Kovarththanan Rajaratnam:
This patch fixes the "Decode as" crash. We now freeze the packetlist before
attempting to clear it. This way we don't have to issue a row deleted signal
either.
svn path=/trunk/; revision=29238
-rw-r--r-- | file.c | 22 | ||||
-rw-r--r-- | gtk/packet_list_store.c | 32 |
2 files changed, 33 insertions, 21 deletions
@@ -1635,6 +1635,17 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, rebuild the clist, however. */ selected_row = -1; + /* Freeze the packet list while we redo it, so we don't get any + screen updates while it happens. */ +#ifdef NEW_PACKET_LIST + new_packet_list_freeze(); +#else + packet_list_freeze(); + + /* Clear it out. */ + packet_list_clear(); +#endif + if (redissect) { /* We need to re-initialize all the state information that protocols keep, because some preference that controls a dissector has changed, @@ -1655,17 +1666,6 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, #endif } - /* Freeze the packet list while we redo it, so we don't get any - screen updates while it happens. */ -#ifdef NEW_PACKET_LIST - new_packet_list_freeze(); -#else - packet_list_freeze(); - - /* Clear it out. */ - packet_list_clear(); -#endif - /* We don't yet know which will be the first and last frames displayed. */ cf->first_displayed = NULL; cf->last_displayed = NULL; diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c index 7b596a9b31..e7c7eb163d 100644 --- a/gtk/packet_list_store.c +++ b/gtk/packet_list_store.c @@ -516,25 +516,37 @@ new_packet_list_new(void) return newpacketlist; } -void -new_packet_list_store_clear(PacketList *packet_list) +#if 0 +static void +packet_list_row_deleted(PacketList *packet_list, guint pos) { GtkTreePath *path; - guint i; + /* Inform the tree view and other interested objects (such as tree row + * references) that we have deleted a row */ + path = gtk_tree_path_new(); + gtk_tree_path_append_index(path, pos); + + gtk_tree_model_row_deleted(GTK_TREE_MODEL(packet_list), path); + + gtk_tree_path_free(path); +} +#endif + +void +new_packet_list_store_clear(PacketList *packet_list) +{ 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); + /* Don't issue a row_deleted signal. We rely on our caller to have disconnected + * the model from the view. + for( ; packet_list->num_rows > 0; --packet_list->num_rows) + packet_list_row_deleted(packet_list, packet_list->num_rows-1); + */ /* XXX - hold on to these rows and reuse them instead */ g_free(packet_list->rows); |