Wireshark-dev: [Wireshark-dev] Prefs GUI handling: Apply followed by Cancel gives incorrect res

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Sun, 03 May 2009 12:45:19 -0400
Summary
-------

While working on fixing various issues with Preferences!Columns
I found the that Preferences!Apply followed by Preferences!Cancel reverts the preferences not to the "preferences settings last saved state" but to the preferences settings state when the preferences window was opened.

(I'm describing the case for the normal default Wireshark configuration when the Preferences Buttons are OK/Apply/Cancel w/o a Save button).


Both the Wireshark Wiki and the Wireshark User's Guide indicate that Preferences ! Cancel should restore the preferences to the "last saved state".

If there's no objection (and assuming that I'm not missing something),
I plan to check in a fix tomorrow (Monday) to update the in-memory saved preferences state when/if the preferences are written to disk for
the Preferences!Apply and Preferences!Save buttons.



Details
-------

In the current Wireshark development SVN (and presumably in the various
1.0 releases) [For "show a save button" set to False]:

Preferences ! Apply followed by Preferences ! Cancel does the following

1. "Apply" writes the preferences to disk (with any changes made since the preferences window was opened);

   (The next time Wireshark is started these preferences will be used).

2. "Cancel" reverts the in-memory preferences to the state of the preferences when the Preferences window was opened (before any changes were made) and *not* to the most recently saved state.

   This is true for the "general" preferences as well as for the the
   protocol preferences.


The fix looks reasonably simple:

For Prefs!Apply and Prefs!Save if/when the prefs are written to disk:

1. (Re)save the "prefs" structure (in memory).

2. (Re)save all the module preferences (in memory).


Bill