*** diff-old/src/xfns.c 2004-10-11 00:24:05.000000000 +0200
--- diff-new/src/xfns.c 2004-10-11 00:18:09.000000000 +0200
***************
*** 1953,1959 ****
--- 1953,1970 ----
char **missing_list;
int missing_count;
char *def_string;
+ Lisp_Object rest, frame;
+ /* See if there is another frame already using same fontset. */
+ FOR_EACH_FRAME (rest, frame)
+ {
+ struct frame *cf = XFRAME (frame);
+ if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
+ && !strcmp (FRAME_XIC_BASE_FONTNAME (cf), base_fontname))
+ return FRAME_XIC_FONTSET (cf);
+ }
+ /* Free the X fontset of frame F if it is the last frame using it. */
+
+ void
+ xic_delete_xfontset (f)
+ struct frame *f;
+ {
+ Lisp_Object rest, frame;
+
+ if (!FRAME_XIC_FONTSET (f))
+ return;
+
+ /* See if there is another frame sharing the same fontset. */
+ FOR_EACH_FRAME (rest, frame)
+ {
+ struct frame *cf = XFRAME (frame);
+ if (cf != f && FRAME_LIVE_P (f) && FRAME_X_P (cf)
+ && FRAME_XIC_FONTSET (cf) == FRAME_XIC_FONTSET (f))
+ return;
+ }
+ /* The fontset is not used anymore. It is safe to free it. */
+ XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
+ }