diff src/xmenu.c @ 7997:dda8e966edf5

(single_keymap_panes): Put menu_item_equiv_key in the gcpro. (menu_item_equiv_key): GCPRO things.
author Richard M. Stallman <rms@gnu.org>
date Tue, 21 Jun 1994 19:12:12 +0000
parents 60795e826dad
children 6fa3cd9b176d
line wrap: on
line diff
--- a/src/xmenu.c	Tue Jun 21 19:10:54 1994 +0000
+++ b/src/xmenu.c	Tue Jun 21 19:12:12 1994 +0000
@@ -298,6 +298,7 @@
   Lisp_Object savedkey, descrip;
   Lisp_Object def1;
   int changed = 0;
+  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
   /* If a help string follows the item string, skip it.  */
   if (CONSP (XCONS (item1)->cdr)
@@ -318,6 +319,8 @@
       descrip = XCONS (cachelist)->cdr;
     }
 
+  GCPRO4 (def, def1, savedkey, descrip);
+
   /* Is it still valid?  */
   def1 = Qnil;
   if (!NILP (savedkey))
@@ -363,6 +366,7 @@
       XCONS (cachelist)->cdr = descrip;
     }
 
+  UNGCPRO;
   *descrip_ptr = descrip;
   return def;
 }
@@ -469,14 +473,16 @@
 		  Lisp_Object descrip;
 		  Lisp_Object tem, enabled;
 
-		  def = menu_item_equiv_key (item_string, item1, &descrip);
-
-		  /* GCPRO because we will call eval.
+		  /* GCPRO because ...enabled_p will call eval
+		     and ..._equiv_key may autoload something.
 		     Protecting KEYMAP preserves everything we use;
 		     aside from that, must protect whatever might be
 		     a string.  Since there's no GCPRO5, we refetch
 		     item_string instead of protecting it.  */
+		  descrip = def = Qnil;
 		  GCPRO4 (keymap, pending_maps, def, descrip);
+
+		  def = menu_item_equiv_key (item_string, item1, &descrip);
 		  enabled = menu_item_enabled_p (def, notreal);
 
 		  UNGCPRO;
@@ -537,15 +543,18 @@
 		      Lisp_Object descrip;
 		      Lisp_Object tem, enabled;
 
-		      def = menu_item_equiv_key (item_string, item1, &descrip);
-
-		      /* GCPRO because we will call eval.
+		      /* GCPRO because ...enabled_p will call eval
+			 and ..._equiv_key may autoload something.
 			 Protecting KEYMAP preserves everything we use;
 			 aside from that, must protect whatever might be
 			 a string.  Since there's no GCPRO5, we refetch
 			 item_string instead of protecting it.  */
 		      GCPRO4 (keymap, pending_maps, def, descrip);
+		      descrip = def = Qnil;
+
+		      def = menu_item_equiv_key (item_string, item1, &descrip);
 		      enabled = menu_item_enabled_p (def, notreal);
+
 		      UNGCPRO;
 
 		      item_string = XCONS (item1)->car;