diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c index 2aae575..41dc23d 100644 --- a/thunar/thunar-shortcuts-model.c +++ b/thunar/thunar-shortcuts-model.c @@ -869,7 +869,7 @@ thunar_shortcuts_model_load (ThunarShortcutsModel *model) { /* ~/.gtk-bookmarks wasn't there or it was unreadable. * here we recreate it with some useful xdg user special dirs */ - const char *old_locale = NULL; + gchar *old_locale = NULL; gchar *locale = NULL; bindtextdomain (XDG_USER_DIRS_PACKAGE, PACKAGE_LOCALE_DIR); @@ -879,6 +879,8 @@ thunar_shortcuts_model_load (ThunarShortcutsModel *model) /* save the old locale */ old_locale = setlocale (LC_MESSAGES, NULL); + if (old_locale != NULL) + old_locale = g_strdup(old_locale); /* set the new locale */ locale = _thunar_get_xdg_user_dirs_locale (); @@ -938,7 +940,8 @@ thunar_shortcuts_model_load (ThunarShortcutsModel *model) /* restore the old locale */ setlocale (LC_MESSAGES, old_locale); - + if (old_locale != NULL) + g_free(old_locale); gtk_tree_path_free (path); /* we try to save the obtained new model */ diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index d258d8f..2c9c40e 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -619,6 +619,8 @@ thunar_window_setup_user_dir_menu_entries (ThunarWindow *window) /* save the old locale */ old_locale = setlocale (LC_MESSAGES, NULL); + if (old_locale != NULL) + old_locale = g_strdup(old_locale); /* set the new locale */ locale = _thunar_get_xdg_user_dirs_locale (); @@ -656,6 +658,8 @@ thunar_window_setup_user_dir_menu_entries (ThunarWindow *window) g_object_unref (home_dir); setlocale (LC_MESSAGES, old_locale); + if (old_locale != NULL) + g_free (old_locale); }