Wireshark-dev: Re: [Wireshark-dev] Problems when changing a dissector preference
From: "Didier" <[email protected]>
Date: Tue, 20 Nov 2007 23:51:40 +0100
[UTF-8?]On Tue, 20 Nov 2007 11:42:12 +0100, Stig Bjørlykke wrote
> 2007/11/20, Didier <[email protected]>:
> > Can you share a small capture?
> 
>
http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=get&target=dmp-examples.pcap.gz
> 
> Add port 24209 in the preferences.
Thanks.

> My problem is smaler, actually.  When rescanning, the first package 
> is dissected 3 times in dmp, the first time with visited true, 
> second with visited false, and third visited true.
Ok
> 
> This first dissection (in dmp) with visited true happens before
> rescan_packets(), and then before visited is set to false.  A comment
> in prefs_main_apply_all() indicates that gui_prefs_apply() could 
> cause redissection.
> 
> Is it correct to pass a packet to a dissector the very first time 
> with visited set to true?
I don't think so. IMO the first call is a bug. 

It's called because the packet is selected and a redissection is triggered
with old frame states (like visited) but only after dissector tables have
been updated. ie wireshark outputs junk.

The culprit is in:
from gtk/proto_draw.c::redraw_hex_dump_all(void)

#if GTK_MAJOR_VERSION >= 2
  /* XXX - this is a hack, to workaround a bug in GTK2.x!
     when changing the font size, even refilling of the corresponding
     gtk_text_buffer doesn't seem to trigger an update.
     The only workaround is to freshly select the frame, which will remove any
     existing notebook tabs and "restart" the whole byte view again. */
  if (cfile.current_frame != 0)
    cf_goto_frame(&cfile, cfile.current_frame);
#endif

Setting cfile.current_frame to 0 is not a good workaround.

Patch below should do it.

Didier

Attachment: pref_redraw_change.patch.gz
Description: GNU Zip compressed data