mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-28 12:58:05 +03:00
AchievementManager: Remove ConfigChangedCallback on shutdown
Prevent SetHardcoreMode from being called after m_client is set to nullptr. rc_client_set_hardcore_enabled() checks for nullptr so this didn't cause any problems, but better not to rely on that. Also prevents multiple SetHardcoreMode callbacks from piling up when repeatedly toggling Config::RA_ENABLED.
This commit is contained in:
parent
e37a195192
commit
9c40a7976b
2 changed files with 4 additions and 1 deletions
|
@ -76,7 +76,7 @@ void AchievementManager::Init(void* hwnd)
|
|||
[](const char* message, const rc_client_t* client) {
|
||||
INFO_LOG_FMT(ACHIEVEMENTS, "{}", message);
|
||||
});
|
||||
Config::AddConfigChangedCallback([this] { SetHardcoreMode(); });
|
||||
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { SetHardcoreMode(); });
|
||||
SetHardcoreMode();
|
||||
m_queue.Reset("AchievementManagerQueue", [](const std::function<void()>& func) { func(); });
|
||||
m_image_queue.Reset("AchievementManagerImageQueue",
|
||||
|
@ -764,6 +764,7 @@ void AchievementManager::Shutdown()
|
|||
{
|
||||
CloseGame();
|
||||
m_queue.Shutdown();
|
||||
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||
std::lock_guard lg{m_lock};
|
||||
// DON'T log out - keep those credentials for next run.
|
||||
rc_client_destroy(m_client);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <rcheevos/include/rc_runtime.h>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/Event.h"
|
||||
#include "Common/HttpRequest.h"
|
||||
#include "Common/JsonUtil.h"
|
||||
|
@ -264,6 +265,7 @@ private:
|
|||
bool m_is_runtime_initialized = false;
|
||||
UpdateCallback m_update_callback = [](const UpdatedItems&) {};
|
||||
std::unique_ptr<DiscIO::Volume> m_loading_volume;
|
||||
Config::ConfigChangedCallbackID m_config_changed_callback_id;
|
||||
Badge m_default_player_badge;
|
||||
Badge m_default_game_badge;
|
||||
Badge m_default_unlocked_badge;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue