aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-12-10 14:03:27 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2015-12-10 14:08:58 +0000
commitbfcd1e65141c7929e447132fcb26f4044276ec20 (patch)
treeebad6261b7155f93e84ac0ccd4e4c8541e86b5cd
parent5062fe0a88a246cc1202fa991e3f37a7733a8371 (diff)
Qt: Reset preferences when reloading Lua plugins
Reading configuration files may duplicate some entries, so ensure we reset preferences before reloading. Change-Id: I746414cbc10c206ddf47669856f329b9e0202a0d Reviewed-on: https://code.wireshark.org/review/12496 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r--ui/qt/main_window_slots.cpp2
-rw-r--r--ui/qt/wireshark_application.cpp14
-rw-r--r--ui/qt/wireshark_application.h2
-rw-r--r--wireshark-qt.cpp2
4 files changed, 11 insertions, 9 deletions
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 6c57504fd9..a14928ddb1 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -2618,7 +2618,7 @@ void MainWindow::on_actionAnalyzeReloadLuaPlugins_triggered()
main_ui_->preferenceEditorFrame->animatedHide();
char *gdp_path, *dp_path;
- (void) wsApp->readConfigurationFiles(&gdp_path, &dp_path);
+ wsApp->readConfigurationFiles(&gdp_path, &dp_path, true);
fieldsChanged();
redissectPackets();
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index d7a3671331..1d0701f5b9 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -349,11 +349,8 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
set_profile_name (profile_name);
emit profileNameChanged(profile_name);
- /* Reset current preferences and apply the new */
- prefs_reset();
-// menu_prefs_reset();
-
- (void) readConfigurationFiles (&gdp_path, &dp_path);
+ /* Apply new preferences */
+ readConfigurationFiles (&gdp_path, &dp_path, true);
if (!recent_read_profile_static(&rf_path, &rf_open_errno)) {
simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK,
@@ -880,7 +877,7 @@ void WiresharkApplication::allSystemsGo()
#endif
}
-_e_prefs *WiresharkApplication::readConfigurationFiles(char **gdp_path, char **dp_path)
+_e_prefs *WiresharkApplication::readConfigurationFiles(char **gdp_path, char **dp_path, bool reset)
{
int gpf_open_errno, gpf_read_errno;
int cf_open_errno, df_open_errno;
@@ -891,6 +888,11 @@ _e_prefs *WiresharkApplication::readConfigurationFiles(char **gdp_path, char **d
int pf_open_errno, pf_read_errno;
e_prefs *prefs_p;
+ if (reset) {
+ // reset preferences before reading
+ prefs_reset();
+ }
+
/* load the decode as entries of this profile */
load_decode_as_entries();
diff --git a/ui/qt/wireshark_application.h b/ui/qt/wireshark_application.h
index d236b97ea0..e4f74b86ef 100644
--- a/ui/qt/wireshark_application.h
+++ b/ui/qt/wireshark_application.h
@@ -92,7 +92,7 @@ public:
void allSystemsGo();
void refreshLocalInterfaces();
- struct _e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path);
+ struct _e_prefs * readConfigurationFiles(char **gdp_path, char **dp_path, bool reset);
QList<recent_item_status *> recentItems() const;
void addRecentItem(const QString filename, qint64 size, bool accessible);
QDir lastOpenDir();
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index 79f4bc9613..4033b5d201 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -867,7 +867,7 @@ DIAG_ON(cast-qual)
splash_update(RA_PREFERENCES, NULL, NULL);
- prefs_p = ws_app.readConfigurationFiles(&gdp_path, &dp_path);
+ prefs_p = ws_app.readConfigurationFiles(&gdp_path, &dp_path, false);
/*
* To reset the options parser, set optreset to 1 on platforms that