# HG changeset patch # User stephent # Date 1147171209 0 # Node ID 77b0b03fbc477c67ede7d9aea5e2a1919ebfff54 # Parent e7fb0df1caea9b6597f2a1096ea1262e12da3579 [xemacs-hg @ 2006-05-09 10:40:07 by stephent] Avoid leaking FontStructs. <87lktblbyt.fsf@tleepslib.sk.tsukuba.ac.jp> diff -r e7fb0df1caea -r 77b0b03fbc47 src/ChangeLog --- a/src/ChangeLog Tue May 09 05:15:15 2006 +0000 +++ b/src/ChangeLog Tue May 09 10:40:09 2006 +0000 @@ -1,3 +1,10 @@ +2006-03-30 Stephen J. Turnbull + + * objects-x.c (x_initialize_font_instance): + Ensure that duplicative X font gets freed if we have an Xft font. + Remove some redundant debug output. + Comment on frequency of calls to this function. + 2006-05-08 Stephen J. Turnbull * EmacsShell-sub.c (RootGeometryManager): diff -r e7fb0df1caea -r 77b0b03fbc47 src/objects-x.c --- a/src/objects-x.c Tue May 09 05:15:15 2006 +0000 +++ b/src/objects-x.c Tue May 09 10:40:09 2006 +0000 @@ -309,6 +309,12 @@ return 0; } + if (rf && fs) + { + XFreeFont (dpy, fs); + fs = NULL; /* we don' need no steenkin' X font */ + } + if (fs && !fs->max_bounds.width) { /* yes, this has been known to happen. */ @@ -316,8 +322,7 @@ fs = NULL; maybe_signal_error (Qgui_error, "X font is too small", f->name, Qfont, errb); - if (!rf) - return 0; + return 0; } /* Now that we're sure that we will succeed, we can allocate data without @@ -353,11 +358,12 @@ f->height = rf->height; f->proportional_p = 1; /* we can't recognize monospaced fonts! */ - DEBUG_XFT4 (0, "initialized metrics ascent %d descent %d width %d height %d\n", - f->ascent, f->descent, f->width, f->height); - /* we also output on initialization of any font below */ - DEBUG_XFT1 (2, "initialized Xft font %s\n", XSTRING_DATA(f->name)); - fs = NULL; /* we don' need no steenkin' X font */ + /* #### This message appears wa-a-ay too often! + We probably need to cache truenames or something? + Even if Xft does it for us, we cons too many font instances. */ + DEBUG_XFT4 (0, + "initialized metrics ascent %d descent %d width %d height %d\n", + f->ascent, f->descent, f->width, f->height); } else {