GNOME Bugzilla – Bug 100801
missing NULL test in pango-context.c
Last modified: 2007-06-20 18:16:35 UTC
In pango-context.c, a call is made to pango_font_map_load_fontset(), which can return NULL, but this is apparently not tested. If NULL, a later call to pango_fontset_get_font () fails. For reasons probably having to do with my running Gentoo/unstable and involving xft2, this is making all gnome2 apps crash for me. pango-context.c: ....... if (current_fonts) g_object_unref (current_fonts); current_fonts = pango_font_map_load_fontset (context->font_map, context, current_desc, language); ........ NOTE: current-fonts apparently never NULL-tested, but can be NULL! analysis->font = pango_fontset_get_font (current_fonts, wc);
Just for yucks, I hacked pango-context.c a little: ...... PangoFontset *new_fonts = pango_font_map_load_fontset (context->font_map, context, current_desc, language); if (new_fonts) { if (current_fonts) g_object_unref (current_fonts); current_fonts = new_fonts; } else g_warning("pango_font_map_load_fontset returned NULL!"); } else pango_font_description_free (next_desc); .... with results as follows: gnome-terminal doesn't complain, but is a no-op. Nautilus bitches and dies: gilgamesh:/usr/src[3]nautilus ** (nautilus:16293): WARNING **: pango_font_map_load_fontset returned NULL! ** (nautilus:16293): CRITICAL **: file pango-fontset.c: line 84 (pango_fontset_get_font): assertion `fontset != NULL' failed ........ ...so while a NULL test might be nice, there is clearly a worse underlying problem involving something xft or somesuch.
Current CVS versions of Pango should exit in this situation with a somewhat informative error message. (pango_context_load_fontset() should never return NULL as long as you have any fonts configured on your system; apparently you don't have any configured.) *** This bug has been marked as a duplicate of 98672 ***
Thanks. I knew there was an underlying font problem, but having pango say something like 'Hey stoopit! Get some fonts, already!' will be useful.