Hi,

At 10 Sep 2001 19:59:30 +0100,
Juliusz Chroboczek <[EMAIL PROTECTED]> wrote:

> 1. The return value of XCreateFontSet is not checked.  Tomohiro, could
> you please fix that?  It would be reasonable to either abort XTerm in
> that case, or to print a warning and continue in Root style, or
> perhaps to switch to the fixed fontset and try again.  Please make
> sure that you avoid looping if you chose the latter fix.

Here is a patch.  When XCreateFontSet() fails, it tries with
XCreateFontSet() again with DEFXIMFONT, i.e., "*".  When it
also fails, it gives up to use XIM.

Another fix is inside PreeditPosition(), where the very position
where segfault occurs.  I inserted a check whether XIM lives or not.

---------
diff -ruN xterm-158/charproc.c xterm-158-1/charproc.c
--- xterm-158/charproc.c        Sun Sep  9 10:22:34 2001
+++ xterm-158-1/charproc.c      Sat Sep 15 00:27:53 2001
@@ -2729,6 +2729,7 @@
     XPoint spot;
     XVaNestedList list;
 
+    if (!screen->xic) return;
     spot.x = CurCursorX(screen, screen->cur_row, screen->cur_col);
     spot.y = CursorY(screen, screen->cur_row) + screen->fs_ascent;
     list = XVaCreateNestedList(0,
@@ -5005,6 +5006,21 @@
                                         &missing_charset_list,
                                         &missing_charset_count,
                                         &def_string);
+       if (term->screen.fs == NULL) {
+           fprintf(stderr,"Preparation of font set "
+                   "\"%s\" for XIM failed.\n", term->misc.f_x);
+           term->screen.fs = XCreateFontSet(XtDisplay(term),
+                                            DEFXIMFONT,
+                                            &missing_charset_list,
+                                            &missing_charset_count,
+                                            &def_string);
+       }
+       if (term->screen.fs == NULL) {
+           fprintf(stderr,"Preparation of default font set "
+                   "\"%s\" for XIM failed.\n", DEFXIMFONT);
+           XCloseIM(xim);
+           return;
+       }
        extents = XExtentsOfFontSet(term->screen.fs);
        j = XFontsOfFontSet(term->screen.fs, &fonts, &font_name_list);
        for (i = 0, term->screen.fs_ascent = 0; i < j; i++) {
---------

Tomohiro KUBOTA <[EMAIL PROTECTED]>
http://www.debian.or.jp/~kubota/
"Introduction to I18N"  http://www.debian.org/doc/manuals/intro-i18n/
_______________________________________________
I18n mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/i18n

Reply via email to