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-02-09 07:35:16 -08:00
parent a4ba5d4859
commit 5009698cc0
54 changed files with 244 additions and 240 deletions
+7 -7
View File
@@ -125,7 +125,7 @@ namespace MainWindow {
}
void CreateHelpMenu(HMENU menu) {
I18NCategory *des = GetI18NCategory("DesktopUI");
auto des = GetI18NCategory("DesktopUI");
const std::wstring visitMainWebsite = ConvertUTF8ToWString(des->T("www.ppsspp.org"));
const std::wstring visitForum = ConvertUTF8ToWString(des->T("PPSSPP Forums"));
@@ -171,7 +171,7 @@ namespace MainWindow {
return false;
}
I18NCategory *ps = GetI18NCategory("PostShaders");
auto ps = GetI18NCategory("PostShaders");
HMENU shaderMenu = GetSubmenuById(menu, ID_OPTIONS_SHADER_MENU);
EmptySubMenu(shaderMenu);
@@ -202,7 +202,7 @@ namespace MainWindow {
}
static void TranslateMenuItem(const HMENU hMenu, const int menuID, const std::wstring& accelerator = L"", const char *key = nullptr) {
I18NCategory *des = GetI18NCategory("DesktopUI");
auto des = GetI18NCategory("DesktopUI");
std::wstring translated;
if (key == nullptr || !strcmp(key, "")) {
@@ -474,7 +474,7 @@ namespace MainWindow {
}
static void setRenderingMode(int mode) {
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
g_Config.iRenderingMode = mode;
switch (g_Config.iRenderingMode) {
@@ -499,7 +499,7 @@ namespace MainWindow {
g_Config.iFrameSkip = FRAMESKIP_OFF;
}
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
std::ostringstream messageStream;
messageStream << gr->T("Frame Skipping") << ":" << " ";
@@ -519,7 +519,7 @@ namespace MainWindow {
g_Config.iFrameSkipType = 0;
}
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
std::ostringstream messageStream;
messageStream << gr->T("Frame Skipping Type") << ":" << " ";
@@ -553,7 +553,7 @@ namespace MainWindow {
void MainWindowMenu_Process(HWND hWnd, WPARAM wParam) {
std::string fn;
I18NCategory *gr = GetI18NCategory("Graphics");
auto gr = GetI18NCategory("Graphics");
int wmId = LOWORD(wParam);
int wmEvent = HIWORD(wParam);