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
This commit is contained in:
Anders Broman 2009-07-29 21:32:49 +00:00
parent 26d1dfcf4c
commit 3ec8398f16
2 changed files with 33 additions and 21 deletions

22
file.c
View File

@ -1635,6 +1635,17 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item,
rebuild the clist, however. */ rebuild the clist, however. */
selected_row = -1; 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) { if (redissect) {
/* We need to re-initialize all the state information that protocols /* We need to re-initialize all the state information that protocols
keep, because some preference that controls a dissector has changed, 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 #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. */ /* We don't yet know which will be the first and last frames displayed. */
cf->first_displayed = NULL; cf->first_displayed = NULL;
cf->last_displayed = NULL; cf->last_displayed = NULL;

View File

@ -516,25 +516,37 @@ new_packet_list_new(void)
return newpacketlist; return newpacketlist;
} }
#if 0
static void
packet_list_row_deleted(PacketList *packet_list, guint pos)
{
GtkTreePath *path;
/* 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 void
new_packet_list_store_clear(PacketList *packet_list) new_packet_list_store_clear(PacketList *packet_list)
{ {
GtkTreePath *path;
guint i;
g_return_if_fail(packet_list != NULL); g_return_if_fail(packet_list != NULL);
g_return_if_fail(PACKETLIST_IS_LIST(packet_list)); g_return_if_fail(PACKETLIST_IS_LIST(packet_list));
if(packet_list->num_rows == 0) if(packet_list->num_rows == 0)
return; return;
path = gtk_tree_path_new(); /* Don't issue a row_deleted signal. We rely on our caller to have disconnected
* the model from the view.
for(i = 0; i < packet_list->num_rows; ++i) { for( ; packet_list->num_rows > 0; --packet_list->num_rows)
gtk_tree_model_row_deleted(GTK_TREE_MODEL(packet_list), path); packet_list_row_deleted(packet_list, packet_list->num_rows-1);
} */
gtk_tree_path_free(path);
/* XXX - hold on to these rows and reuse them instead */ /* XXX - hold on to these rows and reuse them instead */
g_free(packet_list->rows); g_free(packet_list->rows);