fix applying settings to only take actual updates into account (#1027)

This commit is contained in:
Arvid Norberg 2016-08-22 21:38:57 -04:00 committed by GitHub
parent 2a36f9015d
commit 558ec097a2
1 changed files with 9 additions and 0 deletions

View File

@ -598,6 +598,9 @@ namespace libtorrent
if (index < 0 || index >= settings_pack::num_string_settings) if (index < 0 || index >= settings_pack::num_string_settings)
continue; continue;
// if the vaue did not change, don't call the update callback
if (sett.get_str(i->first) == i->second) continue;
sett.set_str(i->first, i->second); sett.set_str(i->first, i->second);
str_setting_entry_t const& sa = str_settings[i->first & settings_pack::index_mask]; str_setting_entry_t const& sa = str_settings[i->first & settings_pack::index_mask];
if (sa.fun && ses if (sa.fun && ses
@ -617,6 +620,9 @@ namespace libtorrent
if (index < 0 || index >= settings_pack::num_int_settings) if (index < 0 || index >= settings_pack::num_int_settings)
continue; continue;
// if the vaue did not change, don't call the update callback
if (sett.get_int(i->first) == i->second) continue;
sett.set_int(i->first, i->second); sett.set_int(i->first, i->second);
int_setting_entry_t const& sa = int_settings[i->first & settings_pack::index_mask]; int_setting_entry_t const& sa = int_settings[i->first & settings_pack::index_mask];
if (sa.fun && ses if (sa.fun && ses
@ -636,6 +642,9 @@ namespace libtorrent
if (index < 0 || index >= settings_pack::num_bool_settings) if (index < 0 || index >= settings_pack::num_bool_settings)
continue; continue;
// if the vaue did not change, don't call the update callback
if (sett.get_bool(i->first) == i->second) continue;
sett.set_bool(i->first, i->second); sett.set_bool(i->first, i->second);
bool_setting_entry_t const& sa = bool_settings[i->first & settings_pack::index_mask]; bool_setting_entry_t const& sa = bool_settings[i->first & settings_pack::index_mask];
if (sa.fun && ses if (sa.fun && ses