mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-30 06:32:56 +00:00
Config: Fix cache not being invalidated when callbacks are suppressed
The config version should always be incremented whenever config is changed, regardless of callbacks being suppressed or not. Otherwise, getters can return stale data until another config change (with callbacks enabled) happens.
This commit is contained in:
parent
351fb71653
commit
9ffd345df0
@ -71,11 +71,14 @@ void AddConfigChangedCallback(ConfigChangedCallback func)
|
||||
|
||||
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)
|
||||
return;
|
||||
|
||||
s_config_version.fetch_add(1, std::memory_order_relaxed);
|
||||
|
||||
for (const auto& callback : s_callbacks)
|
||||
callback();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user