Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] GUIManger in menus.c

Date Prev · Date Next · Thread Prev · Thread Next
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Thu, 30 Sep 2010 17:30:13 -0700
On Sep 30, 2010, at 3:29 PM, Jeff Morriss wrote:

> Anders Broman wrote:
>>  Hi,
>> When using GUIManager for the main menu bar, it blows up loading a file. 
>> Could some one take a look
>> and help me figure out what's wrong? The recent file stuff is also 
>> broken - probably related.
> 
> It's bailing out here:
> 
> ERROR:column-utils.c:1175:col_set_cls_time: code should not be reached
> 
> That means timestamp_set_type() has not been called.
> 
> When we're not using GUIManager, that function is called (during 
> startup) in timestamp_format_cb().
> 
> That function is not called during startup when using GUIManager... 
> Hmmm, actually it's not being called at all.

It's called in:

	change_configuration_profile() (after reading the "recent" file, it's set to the value from that file)

	main(), if "-t" is specified;

	reftime_answered_cb() (if you answer "yes" to "Do you want to switch to "Seconds Since Beginning of Capture" now?")

	timestamp_format_cb() (when you explicitly set it through the GUI)

change_configuration_profile() is called only in profile_select() and select_profile_cb(), when you choose a profile.

The reason why it doesn't start out as TS_RELATIVE in Wireshark is, to quote the comment:

	so that "recent" in gtk/menu.c can detect this and distinguish it from a command line value

That refers to menu_recent_read_finished(), which sets recent.gui_time_format to the current time stamp value if it's not TS_NOT_SET, i.e., if it was set on the command line, that setting overrides whatever is in the recent file.

Is there some reason not to read the recent file *before* parsing the command-line arguments, so that we can just have the time stamp format initialized to TS_RELATIVE, override it from the recent file, and then possibly override *that* from the command line?