Bug#702503: blender 2.66a-1 crashes at launch, when looking for locales dir
Antonio Ospite
ospite at studenti.unina.it
Thu Mar 7 15:44:17 UTC 2013
On Thu, 07 Mar 2013 15:06:33 +0100
Antonio Ospite <ospite at studenti.unina.it> wrote:
[...]
>
> BTW, I think that blender should fail gracefully when it does not find
> a directory or a file, it should not crash, maybe something like this can be
> upstreamed:
>
> -----------------------------------------------------------------------
> diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
> index 73294f1..23dd3d5 100644
> --- a/source/blender/blenfont/intern/blf_lang.c
> +++ b/source/blender/blenfont/intern/blf_lang.c
> @@ -76,16 +76,16 @@ static void free_locales(void)
> num_locales = num_locales_menu = 0;
> }
>
> -static void fill_locales(void)
> +static void fill_locales(char *locale_path)
> {
> - char *languages_path = BLI_get_folder(BLENDER_DATAFILES, "locale");
> + char *languages_path = locale_path;
> LinkNode *lines = NULL, *line;
> char *str;
> int idx = 0;
>
> free_locales();
>
> - BLI_join_dirfile(languages_path, FILE_MAX, languages_path, "languages");
> + BLI_join_dirfile(languages_path, FILE_MAX, locale_path, "languages");
> line = lines = BLI_file_read_as_lines(languages_path);
>
> /* This whole "parsing" code is a bit weak, in that it expects strictly formated input file...
> @@ -189,7 +189,7 @@ void BLF_lang_init(void)
>
> if (messagepath) {
> bl_locale_init(messagepath, TEXT_DOMAIN_NAME);
> - fill_locales();
> + fill_locales(messagepath);
> }
> else {
> printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
>
> -----------------------------------------------------------------------
>
> This would avoid a possible crash even for the pristine code as fill_locales()
> is called only when messagepath has been found.
>
Actually this sentence is not accurate, the original code won't crash,
it is patch 0005 which was incomplete.
But still, a change like the one above may make the code a bit more
robust against patching.
> But I have no time to properly test it and upstream it for now.
>
> Thanks,
> Antonio
--
Antonio Ospite
http://ao2.it
A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
More information about the pkg-multimedia-maintainers
mailing list