On Mon, Aug 31, 2009 at 9:01 PM, Stephen J. Turnbull<stephen(a)xemacs.org> wrote:
However, there's also the question of how Lisp code can crash at
all.
Do you understand that mechanism?
The missing argument to the mule-util version of
truncate-string-to-width causes compute_menubar_data to return NULL
somehow. I still don't understand what's going on there. Then we
trigger the ABORT on line 579 of menubar-x.c.
Please take the minimal reproducer, add it to
tests/reproduce-crashes.el, and make sure it crashes there. Add an
XEmacs bug pointing to this thread and that test. Or I can do it, but
without a tracker entry my memory has been rather fallible of late.
We don't have a minimal reproducer anymore, since I nuked the
offending version of truncate-string-to-width. I've tried to find
other ways to trigger this crash, so far without success. The only
way I know how to do it is to redefine truncate-string-to-width to the
mule-util version. Maybe it should be something like this (where I'm
using old-truncate-string-to-width to avoid affecting the other
tests)?
(defun old-truncate-string-to-width (str end-column &optional
start-column padding)
"Truncate string STR to end at column END-COLUMN.
The optional 2nd arg START-COLUMN, if non-nil, specifies
the starting column; that means to return the characters occupying
columns START-COLUMN ... END-COLUMN of STR.
The optional 3rd arg PADDING, if non-nil, specifies a padding character
to add at the end of the result if STR doesn't reach column END-COLUMN,
or if END-COLUMN comes in the middle of a character in STR.
PADDING is also added at the beginning of the result
if column START-COLUMN appears in the middle of a character in STR.
If PADDING is nil, no padding is added in these cases, so
the resulting string may be narrower than END-COLUMN."
(or start-column
(setq start-column 0))
(let ((len (length str))
(idx 0)
(column 0)
(head-padding "") (tail-padding "")
ch last-column last-idx from-idx)
(condition-case nil
(while (< column start-column)
(setq ch (aref str idx)
column (+ column (char-width ch))
idx (1+ idx)))
(args-out-of-range (setq idx len)))
(if (< column start-column)
(if padding (make-string end-column padding) "")
(if (and padding (> column start-column))
(setq head-padding (make-string (- column start-column) padding)))
(setq from-idx idx)
(if (< end-column column)
(setq idx from-idx)
(condition-case nil
(while (< column end-column)
(setq last-column column
last-idx idx
ch (aref str idx)
column (+ column (char-width ch))
idx (1+ idx)))
(args-out-of-range (setq idx len)))
(if (> column end-column)
(setq column last-column idx last-idx))
(if (and padding (< column end-column))
(setq tail-padding (make-string (- end-column column) padding))))
(setq str (substring str from-idx idx))
(if padding
(concat head-padding str tail-padding)
str))))
(defbug 12 current
"Crash when clicking on the menubar, triggered by a Lisp error due to a
version of truncate-string-to-width that does not take 5 parameters.
Fatal error: assertion failed, file menubar-x.c, line 579, ABORT()
Reported:
https://bugzilla.redhat.com/show_bug.cgi?id=480845
<1251569781.4318.2.camel@mslap>"
(fset 'truncate-string-to-width #'old-truncate-string-to-width)
(accelerate-menu))
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta