After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 100801 - missing NULL test in pango-context.c
missing NULL test in pango-context.c
Status: RESOLVED DUPLICATE of bug 98672
Product: pango
Classification: Platform
Component: general
1.1.x
Other Linux
: Normal normal
: ---
Assigned To: Pango X11 Mainter alias
Pango X11 Mainter alias
Depends on:
Blocks:
 
 
Reported: 2002-12-10 05:36 UTC by Jim Bray
Modified: 2007-06-20 18:16 UTC
See Also:
GNOME target: ---
GNOME version: 2.0



Description Jim Bray 2002-12-10 05:36:58 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);
Comment 1 Jim Bray 2002-12-10 06:19:37 UTC
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. 
Comment 2 Owen Taylor 2002-12-10 06:47:11 UTC
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 ***
Comment 3 Jim Bray 2002-12-10 15:29:17 UTC
  Thanks. I knew there was an underlying font problem, but having 
pango say something like 'Hey stoopit! Get some fonts, already!' 
will be useful.