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 /gtk | |
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
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/packet_list_store.c | 32 |
1 files changed, 22 insertions, 10 deletions
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); |