Ar an t-ochtú lá is fiche de mí na Nollaig, scríobh Jerry James:
[...] This is causing the following practical problem. With an X11
build
and Debug on Signal active, clicking on the menubar causes an immediate
crash due to an assertion failure. A little debugger work shows the
following sequence. Inside of button_item_to_widget_value (src/gui-x.c),
the default-menubar from lisp/menubar-items.el is evaluated, down to one
of the calls to:
(truncate-string-to-width (abbrev-string-to-be-defined nil) 40 nil nil t)
The abbrev-string-to-be-defined call returns "j.\n\n" (which doesn't
seem right; where did that come from?). Evaluating
truncate-string-to-width triggers the args_out_of_range, thereby
unwinding the stack up to the call_trapping_problems call in
menu_item_descriptor_to_widget_value (menubar-x.c). Since retval is
unbound, this function returns NULL, and therefore
compute_menubar_data also returns NULL. This triggers the assert() in
set_frame_menubar (menubar-x.c) just after the call to
compute_menubar_data and *boom* goes XEmacs.
This is interesting, and what to do isn’t particularly clear.
(setq debug-on-signal t) is supposed to enter the debugger even if the
signal is caught, so in design terms nothing is wrong here. Except that we
crash, and that’s clearly wrong ...
It *is* a bit of an infelicity in the implementation of
#'truncate-string-to-width that it signals as a matter of course, so this
patch is probably appropriate anyway. But should call_trapping_problems()
just bind Vdebug_on_signal to a non-nil value?
--- subr.el~ 2011-12-31 15:10:30.000000000 +0000
+++ subr.el 2011-12-31 15:13:32.000000000 +0000
@@ -1067,12 +1067,10 @@
ch last-column last-idx from-idx)
;; find the index of START-COLUMN; bail out if end of string reached.
- (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)))
+ (while (and (< column start-column) (< idx len))
+ (setq ch (aref str idx)
+ column (+ column (char-width ch))
+ idx (1+ idx)))
(if (< column start-column)
;; if string ends before START-COLUMN, return either a blank string
;; or a string entirely padded.
@@ -1100,14 +1098,12 @@
(setq end-column (- end-column (string-width ellipses)))))
;; find the index of END-COLUMN; bail out if end of string reached.
- (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)))
+ (while (and (< column end-column) (< idx len))
+ (setq last-column column
+ last-idx idx
+ ch (aref str idx)
+ column (+ column (char-width ch))
+ idx (1+ idx)))
;; if we went too far (stopped in middle of character), back up.
(if (> column end-column)
(setq column last-column idx last-idx))
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta