Mercurial > hg > xemacs-beta
changeset 1918:59bf16be00bf
[xemacs-hg @ 2004-02-19 02:49:18 by james]
Protect against menubar computations within redisplay.
author | james |
---|---|
date | Thu, 19 Feb 2004 02:49:20 +0000 |
parents | a84a8743f195 |
children | 9bde73b8c020 |
files | src/ChangeLog src/menubar-x.c |
diffstat | 2 files changed, 46 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Wed Feb 18 22:50:49 2004 +0000 +++ b/src/ChangeLog Thu Feb 19 02:49:20 2004 +0000 @@ -1,3 +1,11 @@ +2004-02-17 Jerry James <james@xemacs.org> + + * menubar-x.c (protected_menu_item_descriptor_to_widget_value_1): + Move begin_gc_forbidden() here so it affects all callers. + * menubar-x.c (menu_item_descriptor_to_widget_value): Call + protected_menu_item_descriptor_to_widget_value_1 with + call_trapping_problems. + 2004-02-16 Jerry James <james@xemacs.org> * gui-x.c (wv_set_evalable_slot): Check for eval within redisplay.
--- a/src/menubar-x.c Wed Feb 18 22:50:49 2004 +0000 +++ b/src/menubar-x.c Thu Feb 19 02:49:20 2004 +0000 @@ -336,23 +336,6 @@ return wv; } -static widget_value * -menu_item_descriptor_to_widget_value (Lisp_Object desc, - int menu_type, /* if this is a menubar, - popup or sub menu */ - int deep_p, /* */ - int filter_p) /* if :filter forms - should run now */ -{ - widget_value *wv; - int count = begin_gc_forbidden (); - /* Can't GC! */ - wv = menu_item_descriptor_to_widget_value_1 (desc, menu_type, deep_p, - filter_p, 0); - unbind_to (count); - return wv; -} - struct menu_item_descriptor_to_widget_value { Lisp_Object desc; @@ -365,11 +348,14 @@ { struct menu_item_descriptor_to_widget_value *midtwv = (struct menu_item_descriptor_to_widget_value *) gack; - - midtwv->wv = menu_item_descriptor_to_widget_value (midtwv->desc, - midtwv->menu_type, - midtwv->deep_p, - midtwv->filter_p); + int count = begin_gc_forbidden (); + /* Can't GC! */ + midtwv->wv = menu_item_descriptor_to_widget_value_1 (midtwv->desc, + midtwv->menu_type, + midtwv->deep_p, + midtwv->filter_p, + 0); + unbind_to (count); return Qnil; } @@ -405,6 +391,36 @@ return midtwv.wv; } +/* The two callers of menu_item_descriptor_to_widget_value may both run while + in redisplay. Some descriptor to widget value conversions call Feval, and + at least one calls QUIT. Hence, we have to establish protection here.. */ + +static widget_value * +menu_item_descriptor_to_widget_value (Lisp_Object desc, + int menu_type, /* if this is a menubar, + popup or sub menu */ + int deep_p, /* */ + int filter_p) /* if :filter forms + should run now */ +{ + struct menu_item_descriptor_to_widget_value midtwv; + Lisp_Object retval; + + midtwv.desc = desc; + midtwv.menu_type = menu_type; + midtwv.deep_p = deep_p; + midtwv.filter_p = filter_p; + + retval = call_trapping_problems + (Qevent, "Error during menu construction", 0, NULL, + protected_menu_item_descriptor_to_widget_value_1, &midtwv); + + if (UNBOUNDP (retval)) + return NULL; + + return midtwv.wv; +} + /* The order in which callbacks are run is funny to say the least. It's sometimes tricky to avoid running a callback twice, and to avoid returning prematurely. So, this function returns true