From: Gerd Moellmann Date: Sat, 17 Nov 2001 10:46:45 +0000 (+0000) Subject: (tool_bar_item_info): Avoid calling Fget_text_property X-Git-Tag: ttn-vms-21-2-B4~18441 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=be67609465d2eeab2f51e6403f5d6ae1395669ca;p=emacs.git (tool_bar_item_info): Avoid calling Fget_text_property with invalid position. --- diff --git a/src/ChangeLog b/src/ChangeLog index dcd69d8744d..90f8929bbcc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-11-17 Gerd Moellmann + + * xdisp.c (tool_bar_item_info): Avoid calling Fget_text_property + with invalid position. + 2001-11-16 Richard M. Stallman * syswait.h: Delete conditionals for HPUX7, ISC 4.1, and convex. diff --git a/src/xdisp.c b/src/xdisp.c index 0922084f560..332c11c974e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7935,11 +7935,18 @@ tool_bar_item_info (f, glyph, prop_idx) { Lisp_Object prop; int success_p; + int charpos; + + /* This function can be called asynchronously, which means we must + exclude any possibility that Fget_text_property signals an + error. */ + charpos = min (XSTRING (f->current_tool_bar_string)->size, glyph->charpos); + charpos = max (0, charpos); /* Get the text property `menu-item' at pos. The value of that property is the start index of this item's properties in F->tool_bar_items. */ - prop = Fget_text_property (make_number (glyph->charpos), + prop = Fget_text_property (make_number (charpos), Qmenu_item, f->current_tool_bar_string); if (INTEGERP (prop)) {