Hi Richard,
As I saw my name in the subject line, I thought I'd better reply :)))
The reason for preserving the old filter objects in a list is that
there are still references to these objects. That was the reason I
*had* to preserve copies of these objects for as long as the capture
file was open; I had erratic color updates if I released the
colorfilter object and scrolled through my packet list (that memory
could still be read but was being overwritten in the meantime).
I am not 100% sure whether we can get rid of the "removed filter list"
at the time we recolorize, or only when we close a capture file.
Regards,
Olivier
----- Original Message -----
From: Richard Urwin
| 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
|
| _______________________________________________
| Ethereal-dev mailing list
| Ethereal-dev@xxxxxxxxxxxx
| http://www.ethereal.com/mailman/listinfo/ethereal-dev
|