Merge pull request #9386 from leoetlino/config-cache-invalidate
Config: Fix cache not being invalidated when callbacks are suppressed
This commit is contained in:
commit
3b2e31230f
|
@ -71,11 +71,14 @@ void AddConfigChangedCallback(ConfigChangedCallback func)
|
||||||
|
|
||||||
void OnConfigChanged()
|
void OnConfigChanged()
|
||||||
{
|
{
|
||||||
|
// Increment the config version to invalidate caches.
|
||||||
|
// To ensure that getters do not return stale data, this should always be done
|
||||||
|
// even when callbacks are suppressed.
|
||||||
|
s_config_version.fetch_add(1, std::memory_order_relaxed);
|
||||||
|
|
||||||
if (s_callback_guards)
|
if (s_callback_guards)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_config_version.fetch_add(1, std::memory_order_relaxed);
|
|
||||||
|
|
||||||
for (const auto& callback : s_callbacks)
|
for (const auto& callback : s_callbacks)
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue