forked from bartvdbraak/blender
Fix #32819: Crash when starting CUDA kernel compilation if UI translation is not "Default"
Issue was caused by some boost filesystem routines accessing current locale and such an access failed in cases code page isn't specified for the current locale. Made it so UTF-8 locale name would be tried to be used first.
This commit is contained in:
parent
aacdd76c06
commit
0ee9f123b2
@ -214,11 +214,33 @@ void BLF_lang_set(const char *str)
|
|||||||
get_language_variable("LANGUAGE", default_language, sizeof(default_language));
|
get_language_variable("LANGUAGE", default_language, sizeof(default_language));
|
||||||
|
|
||||||
if (short_locale[0]) {
|
if (short_locale[0]) {
|
||||||
if (G.debug & G_DEBUG)
|
char *short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);
|
||||||
printf("Setting LANG= and LANGUAGE to %s\n", short_locale);
|
|
||||||
|
|
||||||
BLI_setenv("LANG", short_locale);
|
if (G.debug & G_DEBUG)
|
||||||
BLI_setenv("LANGUAGE", short_locale);
|
printf("Setting LANG and LANGUAGE to %s\n", short_locale_utf8);
|
||||||
|
|
||||||
|
locreturn = setlocale(LC_ALL, short_locale_utf8);
|
||||||
|
|
||||||
|
if (locreturn != NULL) {
|
||||||
|
BLI_setenv("LANG", short_locale_utf8);
|
||||||
|
BLI_setenv("LANGUAGE", short_locale_utf8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (G.debug & G_DEBUG)
|
||||||
|
printf("Setting LANG and LANGUAGE to %s\n", short_locale);
|
||||||
|
|
||||||
|
locreturn = setlocale(LC_ALL, short_locale);
|
||||||
|
|
||||||
|
if (locreturn != NULL) {
|
||||||
|
BLI_setenv("LANG", short_locale);
|
||||||
|
BLI_setenv("LANGUAGE", short_locale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (G.debug & G_DEBUG && locreturn == NULL)
|
||||||
|
printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
|
||||||
|
|
||||||
|
MEM_freeN(short_locale_utf8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (G.debug & G_DEBUG)
|
if (G.debug & G_DEBUG)
|
||||||
@ -226,43 +248,27 @@ void BLF_lang_set(const char *str)
|
|||||||
|
|
||||||
BLI_setenv("LANG", default_lang);
|
BLI_setenv("LANG", default_lang);
|
||||||
BLI_setenv("LANGUAGE", default_language);
|
BLI_setenv("LANGUAGE", default_language);
|
||||||
|
locreturn = setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
if (G.debug & G_DEBUG && locreturn == NULL)
|
||||||
|
printf("Could not reset locale\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
locreturn = setlocale(LC_ALL, short_locale);
|
|
||||||
|
|
||||||
if (locreturn == NULL) {
|
if (locreturn == NULL) {
|
||||||
char *short_locale_utf8 = NULL;
|
char language[65];
|
||||||
|
|
||||||
if (short_locale[0]) {
|
get_language(long_locale, default_lang, language, sizeof(language));
|
||||||
short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);
|
|
||||||
locreturn = setlocale(LC_ALL, short_locale_utf8);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (locreturn == NULL) {
|
if (G.debug & G_DEBUG)
|
||||||
char language[65];
|
printf("Fallback to LANG=%s and LANGUAGE=%s\n", default_lang, language);
|
||||||
|
|
||||||
get_language(long_locale, default_lang, language, sizeof(language));
|
/* Fallback to default settings. */
|
||||||
|
BLI_setenv("LANG", default_lang);
|
||||||
|
BLI_setenv("LANGUAGE", language);
|
||||||
|
|
||||||
if (G.debug & G_DEBUG) {
|
locreturn = setlocale(LC_ALL, "");
|
||||||
if (short_locale[0])
|
|
||||||
printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
|
|
||||||
else
|
|
||||||
printf("Could not reset locale\n");
|
|
||||||
|
|
||||||
printf("Fallback to LANG=%s and LANGUAGE=%s\n", default_lang, language);
|
ok = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/* Fallback to default settings. */
|
|
||||||
BLI_setenv("LANG", default_lang);
|
|
||||||
BLI_setenv("LANGUAGE", language);
|
|
||||||
|
|
||||||
locreturn = setlocale(LC_ALL, "");
|
|
||||||
|
|
||||||
ok = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (short_locale_utf8)
|
|
||||||
MEM_freeN(short_locale_utf8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user