Bug 576910: small fix on "Show 'Language' setting languages in native language"

glib's g_getenv() doc says: "The returned string may be overwritten by
the next call to g_getenv(), g_setenv() or g_unsetenv()". And I do
g_setenv() calls just after, while I wish to keep the value intact.

As a consequence, even though the previous commit seemed to work just fine,
I duplicate the return value of g_getenv(), just to be on the safe side.
This commit is contained in:
Jehan
2013-07-03 20:38:42 +09:00
parent f6dcde1ee6
commit 4eecd9b4ac
2 changed files with 6 additions and 3 deletions

View File

@ -83,8 +83,8 @@ gimp_translation_store_init (GimpTranslationStore *store)
static void
gimp_translation_store_constructed (GObject *object)
{
const gchar *current_lang = g_getenv ("LANGUAGE");
GimpTranslationStore *store = GIMP_TRANSLATION_STORE (object);
gchar *current_lang = g_strdup (g_getenv ("LANGUAGE"));
gchar *label;
G_OBJECT_CLASS (parent_class)->constructed (object);
@ -103,6 +103,8 @@ gimp_translation_store_constructed (GObject *object)
setlocale (LC_ALL, NULL));
g_setenv ("LANGUAGE", current_lang, TRUE);
setlocale (LC_ALL, "");
g_free (current_lang);
GIMP_LANGUAGE_STORE_CLASS (parent_class)->add (GIMP_LANGUAGE_STORE (store),
label,
NULL);