Core: Use a shared_ptr for i18n categories.

This does not make them thread safe, but it reduces the chances of a crash
a bit (see #12594.)
This commit is contained in:
Unknown W. Brackets 2020-01-26 10:43:18 -08:00
parent a4ba5d4859
commit 5009698cc0
54 changed files with 244 additions and 240 deletions

View file

@ -661,7 +661,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
}
I18NCategory *des = GetI18NCategory("DesktopUI");
auto des = GetI18NCategory("DesktopUI");
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
@ -956,7 +956,7 @@ void TakeScreenshot() {
if (success) {
osm.Show(filename);
} else {
I18NCategory *err = GetI18NCategory("Error");
auto err = GetI18NCategory("Error");
osm.Show(err->T("Could not save screenshot file"));
}
}
@ -1105,7 +1105,7 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
UIBackgroundInit(*uiContext);
}
if (msg == "savestate_displayslot") {
I18NCategory *sy = GetI18NCategory("System");
auto sy = GetI18NCategory("System");
std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), SaveState::GetCurrentSlot() + 1);
// Show for the same duration as the preview.
osm.Show(msg, 2.0f, 0xFFFFFF, -1, true, "savestate_slot");
@ -1119,7 +1119,7 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
}
if (msg == "core_powerSaving") {
if (value != "false") {
I18NCategory *sy = GetI18NCategory("System");
auto sy = GetI18NCategory("System");
#ifdef __ANDROID__
osm.Show(sy->T("WARNING: Android battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving");
#else