Ethereal-dev: [Ethereal-dev] Color filters changes, explanation please (Olivier?)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Richard Urwin <richard@xxxxxxxxxxxxxxx>
Date: Tue, 1 Jun 2004 15:45:14 +0100
I am (finally) getting to grips with the mis-feature that color filters 
are edited in place, and therefore the Cancel button does not back-out 
changes. To do this I need to copy the filter_list to some local 
storage and copy it back when the Apply or OK button is clicked.

Since I last looked at the code the handling of this list has been 
changed somewhat, the burden of which is the following:

/* Remove the specified filter from the list of existing color filters,
 * and add it to the list of removed color filters.
 * This way, unmarking and marking a packet which matches a now removed
 * color filter will still be colored correctly as the color filter is
 * still reachable. */
void remove_color_filter(color_filter_t *colorf)
{
	/* Remove colorf from the list of color filters */
	filter_list = g_slist_remove(filter_list, colorf);
	/* Add colorf to the list of removed color filters */
	removed_filter_list = g_slist_prepend(removed_filter_list, colorf);
}


I can see this is a useful bit of code, but I'm not exactly sure how it 
should be altered to handle the local copy. The removed_filter_list is 
not cleared until the whole filter list is deleted. What are the 
constraints? Do I have to keep both lists around until I delete them 
(in which case I should only have one removed_filter_list, but copy the 
filter_list,) or can I purge the removed_filter_list when I re-colorize 
the packets, (in which case I should have a copy of both)?

TIA,

-- 
Richard Urwin