mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
System: Fix possible race condition in presence update
This commit is contained in:
parent
45291c5afe
commit
2e0b0d3963
|
@ -5886,15 +5886,14 @@ void System::UpdateRichPresence(bool update_session_time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto lock = Achievements::GetLock();
|
||||||
|
|
||||||
std::string state_string;
|
std::string state_string;
|
||||||
if (Achievements::HasRichPresence())
|
if (Achievements::HasRichPresence())
|
||||||
{
|
rp.state = (state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128)).c_str();
|
||||||
const auto lock = Achievements::GetLock();
|
|
||||||
state_string = StringUtil::Ellipsise(Achievements::GetRichPresenceString(), 128);
|
|
||||||
rp.state = state_string.c_str();
|
|
||||||
if (const std::string& icon_url = Achievements::GetGameIconURL(); !icon_url.empty())
|
if (const std::string& icon_url = Achievements::GetGameIconURL(); !icon_url.empty())
|
||||||
rp.largeImageKey = icon_url.c_str();
|
rp.largeImageKey = icon_url.c_str();
|
||||||
}
|
|
||||||
|
|
||||||
dyn_libs::Discord_UpdatePresence(&rp);
|
dyn_libs::Discord_UpdatePresence(&rp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue