diff options
| author | Dentomologist <dentomologist@gmail.com> | 2025-04-25 12:16:26 -0700 |
|---|---|---|
| committer | Dentomologist <dentomologist@gmail.com> | 2025-04-25 16:04:12 -0700 |
| commit | 3a883f28d675f971509c165cfedeba861ecdd48a (patch) | |
| tree | 83f56a15010c8133860c5792b234eb9094665ca4 /Source/Core/Common/Config | |
| parent | 45b9def42c25203c6a18478dcddd87ea543a7e2c (diff) | |
Config: Add [[nodiscard]] to AddConfigChangedCallback
Require callers of Config::AddConfigChangedCallback and
CPUThreadConfigCallback::AddConfigChangedCallback to handle the returned
ConfigChangedCallbackIDs to hopefully prevent future issues with
callbacks getting called after their associated objects have been
destroyed.
Diffstat (limited to 'Source/Core/Common/Config')
| -rw-r--r-- | Source/Core/Common/Config/Config.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/Core/Common/Config/Config.h b/Source/Core/Common/Config/Config.h index d7b370282a..ea6058a8d3 100644 --- a/Source/Core/Common/Config/Config.h +++ b/Source/Core/Common/Config/Config.h @@ -29,9 +29,9 @@ void AddLayer(std::unique_ptr<ConfigLayerLoader> loader); std::shared_ptr<Layer> GetLayer(LayerType layer); void RemoveLayer(LayerType layer); -// Returns an ID that can be passed to RemoveConfigChangedCallback(). -// The callback may be called from any thread. -ConfigChangedCallbackID AddConfigChangedCallback(ConfigChangedCallback func); +// Returns an ID that should be passed to RemoveConfigChangedCallback() when the callback is no +// longer needed. The callback may be called from any thread. +[[nodiscard]] ConfigChangedCallbackID AddConfigChangedCallback(ConfigChangedCallback func); void RemoveConfigChangedCallback(ConfigChangedCallbackID callback_id); void OnConfigChanged(); |
