aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorJim Young <jyoung@gsu.edu>2019-12-10 22:01:16 -0500
committerAnders Broman <a.broman58@gmail.com>2019-12-16 05:34:28 +0000
commit8fbe28b1f0b24fee1e1a27ccdb6b8f893c43f133 (patch)
tree3d0f4308950d2f14a7fb549681ea6bd25fdd73a4 /ui/qt
parentd90a22c1cc3a6eaf739e9f4b40ea276dbc916d62 (diff)
profiles: Try to better sync on disk config state
Profile specific column settings are split across the `preferences' file and the `recent' file. At any given moment the GUI column settings held within the `preferences' file and the `recent' file may be inconsistent with one another and with the GUI itself. These inconsistencies occur because of when the GUI chooses to write config changes to disk. If Wireshark is not shutdown gracefully (for example when killed or should crash) the column preferences saved on disk may not be consistent between the current profile's `preferences` and `recent` files and the most recently used profile may not be recorded within the `recent_common' file. On restarting Wireshark these config file inconsistencies can lead to unexpected artifacts. Normally the column config state saved within the current profile's `preferences' and `recent` files are made consistent when a different profile is selected or when Wireshark is closed gracefully. This patch set attempts to improve the constancy of the on disk config state with the GUI state by invoking the functions to write the `recent' and `recent_common' files in a more timely manner. Fix a typo while here. Change-Id: I2af9d9eb2dcf9cc0d422e9840aa05f4f6b1aa086 Reviewed-on: https://code.wireshark.org/review/35407 Petri-Dish: Jim Young <jim.young.ws@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Jim Young <jim.young.ws@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/wireshark_application.cpp7
-rw-r--r--ui/qt/wireshark_application.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 7fb754652f..eb56e2f167 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -359,7 +359,7 @@ int WiresharkApplication::monospaceTextSize(const char *str)
#endif
}
-void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bool write_recent)
+void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bool write_recent_file)
{
char *rf_path;
int rf_open_errno;
@@ -402,7 +402,7 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bo
/* Get the current geometry, before writing it to disk */
emit profileChanging();
- if (write_recent && profile_exists(get_profile_name(), FALSE))
+ if (write_recent_file && profile_exists(get_profile_name(), FALSE))
{
/* Write recent file for profile we are leaving, if it still exists */
write_profile_recent();
@@ -454,6 +454,9 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name, bo
emit localInterfaceListChanged();
emit packetDissectionChanged();
+
+ /* Write recent_common file to ensure last used profile setting is stored. */
+ write_recent();
}
void WiresharkApplication::reloadLuaPluginsDelayed()
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index 704caf633d..09e8fe4c56 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -112,7 +112,7 @@ public:
const QFont monospaceFont(bool zoomed = false) const;
void setMonospaceFont(const char *font_string);
int monospaceTextSize(const char *str);
- void setConfigurationProfile(const gchar *profile_name, bool write_recent = true);
+ void setConfigurationProfile(const gchar *profile_name, bool write_recent_file = true);
void reloadLuaPluginsDelayed();
bool isInitialized() { return initialized_; }
void setReloadingLua(bool is_reloading) { is_reloading_lua_ = is_reloading; }