Gunnar Evermann <ge204(a)eng.cam.ac.uk> wrote on 13 Dec 1999:
This is one of the oldest crashes on my to do list.
loading the following in a vanilla Mule XEmacs will trigger a crash.
(defun delete-and-split ()
(interactive)
(delete-other-windows)
(split-window))
(split-window-vertically)
(insert "が")
(backward-char)
(redraw-frame)
(delete-and-split)
Fatal error: assertion failed, file
/deb-huge/home/gunnar/src/XEmacs/xemacs/src/objects.h, line 143, RECORD_TYPEP (obj,
&lrecord_font_instance)
[... rest of backtrace see Gunnar's original message,
Message-ID: <874sdmtok3.fsf(a)eng.cam.ac.uk> ...]
Gunnar offered the following patch, which I am using all the time
since then and apply to every new release of XEmacs (21.1 and 21.2):
The problem is that the face cache doesn't contain the font
instance
for the relevant charset or to be precise that the cache has been
cleared but we do not regenerate the necessary entries.
A quick fix for the crash would be adding a call to
ensure_face_cachel_contains_charset() at the relevant place in
x_output_string like this:
Index: redisplay-x.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay-x.c,v
retrieving revision 1.23.2.17
diff -u -r1.23.2.17 redisplay-x.c
--- redisplay-x.c 1999/10/15 10:11:51 1.23.2.17
+++ redisplay-x.c 1999/12/13 22:58:35
@@ -879,10 +879,14 @@
for (i = 0; i < nruns; i++)
{
- Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
- struct Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
+ Lisp_Object font;
+ struct Lisp_Font_Instance *fi;
int this_width;
int need_clipping;
+
+ ensure_face_cachel_contains_charset(cachel, window, runs[i].charset);
+ font = FACE_CACHEL_FONT (cachel, runs[i].charset);
+ fi = XFONT_INSTANCE (font);
if (EQ (font, Vthe_null_font_instance))
continue;
This works but is kindof expensive to do, as x_output_string is called
very very often :-)
I don't notice any slowdown or any other negative effects.
Maybe our Mule and redisplay experts can try to come up with
something
more clever...
If nothing better can be found, then maybe Gunnars patch could be
applied to XEmacs?
For my usage pattern, Gunnars patch is essential, without it XEmacs
crashes extremely often while using the 'lookup.el' interface to
electronic dictionaries.
I can reproduce a crash using lookup.el easily by doing the following:
~$ xemacs
C-x C-y t e s t (C-x C-y runs `lookup-pattern')
C-x 1 (C-x 1 runs `delete-other-windows')
C-x C-y t e s t (C-x C-y runs `lookup-pattern')
M-x p (M-p runs `lookup-history-previous')
=> crash.
The dictionary I use to reproduce this crash with lookup.el is
"Iwanami Shoten Koujien Daiyonban"[1], a Japanese dictionary. To
reproduce the crash, a Japanese dictionary is certainly necessary.
Gunnar's elisp example code above, which reproduces the crash, uses
(insert "が"), which inserts a Japanese character.
When using 'lookup.el' wich a Japanese dictionary, similar things like
in Gunnar's example code happen all the time. When looking up a few
random words in the dictionary, splitting windows a few times, going
back and forth in the history of the looked up words, XEmacs will
certainly crash soon. That means XEmacs won't usually survive longer
than a few minutes if one is using 'lookup.el' with a Japanese
dictionary.
What do you think? Doesn't it make sense to apply Gunnar's patch? It
solves the above problems and doesn't seem to do any harm. Or does
anybody know a better solution?
Mike
Footnotes:
[1] 岩波書店 広辞苑(第四版)
--
Mike Fabian <mike.fabian(a)gmx.de>