Andy Piper <andy(a)xemacs.org> writes:
At 05:47 PM 1/19/00 +0900, Yoshiki Hayashi wrote:
>Evaluating following test in glyph-test.el crashes XEmacs.
>
>(set-extent-begin-glyph
> (make-extent (point) (point))
> (make-glyph
> [button :face modeline-mousable
> :descriptor "ok" :callback foo
> :image [xpm :file "../etc/xemacs-icon.xpm"]]))
Works for me - maybe its mule-specific?
I investigated further and found the problem. This crash
involves two bugs.
First, x_locate_pimap_file tests relative file name with
Ffile_readable_p, which internally expands file name, but it
doesn't return expanded file name. Thus, XpmReadFileToData
fails.
Second, x_button_instantiate doesn't check whether glyph is
actually a pixmap. I think you can reproduce crash with this.
(set-extent-begin-glyph
(make-extent (point) (point))
(make-glyph
[button :face modeline-mousable
:descriptor "ok" :callback foo
:image [nothing]]))
2000-01-24 Yoshiki Hayashi <yoshiki(a)xemacs.org>
* glyphs-x.c (x_button_instantiate): Don't add image if
it is not a pixmap.
(x_locate_pixmap_file): Call Fexpand_file_name when file name
is relative.
Index: glyphs-x.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-x.c,v
retrieving revision 1.49.2.45
diff -u -r1.49.2.45 glyphs-x.c
--- glyphs-x.c 2000/01/18 13:54:41 1.49.2.45
+++ glyphs-x.c 2000/01/24 03:26:53
@@ -564,7 +564,7 @@
(XSTRING_BYTE (name, 2) == '/')))))
{
if (!NILP (Ffile_readable_p (name)))
- return name;
+ return Fexpand_file_name (name, Qnil);
else
return Qnil;
}
@@ -2540,7 +2540,8 @@
pointer_bg, dest_mask, domain, "button", wv);
/* add the image if one was given */
- if (!NILP (glyph) && IMAGE_INSTANCEP (glyph))
+ if (!NILP (glyph) && IMAGE_INSTANCEP (glyph)
+ && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (glyph)))
{
Arg al [2];
int ac =0;
--
Yoshiki Hayashi