forked from osmocom/wireshark
extcap: fix parameters save in preferences file
Since g583150198b, extcap_arg structures holds a pointer to the current preference value. So let's not update its value outside of the prefs API otherwise the call to prefs_set_string_value() with pref_current done afterwards will never notify the change and the updated value will not be written in the preference file. Moreover update ExtcapArgument::resetValue() method to have an empty string instead of a NULL pointer. Otherwise prefs_set_string_value() will not notify the change and save the restored default value in the preference file either. Change-Id: Ie70e79d471c75e25705c7654e420a7706ebc4032 Reviewed-on: https://code.wireshark.org/review/23308 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
5178905063
commit
c199952f5c
10
extcap.c
10
extcap.c
|
@ -605,16 +605,6 @@ void extcap_cleanup(void)
|
|||
g_hash_table_destroy(_tool_for_ifname);
|
||||
}
|
||||
|
||||
void extcap_pref_store(extcap_arg *arg, const char *newval)
|
||||
{
|
||||
if (arg && arg->pref_valptr != NULL)
|
||||
{
|
||||
g_free(*arg->pref_valptr);
|
||||
*arg->pref_valptr = g_strdup(newval);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a pointer which can store a value for the given preference name.
|
||||
* The preference name that can be passed to the prefs API is stored into
|
||||
|
|
3
extcap.h
3
extcap.h
|
@ -152,9 +152,6 @@ extcap_if_cleanup(capture_options * capture_opts, gchar ** errormsg);
|
|||
struct preference *
|
||||
extcap_pref_for_argument(const gchar *ifname, struct _extcap_arg * arg);
|
||||
|
||||
void
|
||||
extcap_pref_store(struct _extcap_arg * arg, const char * newval);
|
||||
|
||||
/* Clean up global extcap stuff on program exit */
|
||||
void extcap_cleanup(void);
|
||||
|
||||
|
|
|
@ -662,11 +662,9 @@ QString ExtcapArgument::prefValue()
|
|||
|
||||
void ExtcapArgument::resetValue()
|
||||
{
|
||||
// XXX consider using the preferences API which can store the default value
|
||||
// and put that here instead of an empty value.
|
||||
if (_argument->pref_valptr) {
|
||||
g_free(*_argument->pref_valptr);
|
||||
*_argument->pref_valptr = NULL;
|
||||
*_argument->pref_valptr = g_strdup("");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -494,9 +494,6 @@ void ExtcapOptionsDialog::storeValues()
|
|||
{
|
||||
gchar * val = g_strdup(value.length() == 0 ? " " : value.toStdString().c_str());
|
||||
|
||||
/* Setting the internally stored value for the preference to the new value */
|
||||
extcap_pref_store((*iter)->argument(), val);
|
||||
|
||||
g_hash_table_insert(entries, g_strdup(key.toStdString().c_str()), val);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue