emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32menu.c,v


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32menu.c,v
Date: Mon, 09 Jun 2008 23:10:33 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   08/06/09 23:10:33

Index: w32menu.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32menu.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- w32menu.c   9 Jun 2008 22:05:54 -0000       1.104
+++ w32menu.c   9 Jun 2008 23:10:32 -0000       1.105
@@ -702,6 +702,8 @@
 
       /* Fill in menu_items with the current menu bar contents.
         This can evaluate Lisp code.  */
+      save_menu_items ();
+
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
       submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
@@ -761,7 +763,6 @@
        }
 
       set_buffer_internal_1 (prev);
-      unbind_to (specpdl_count, Qnil);
 
       /* If there has been no change in the Lisp-level contents
         of the menu bar, skip redisplaying it.  Just exit.  */
@@ -773,11 +774,17 @@
       if (i == menu_items_used && i == previous_menu_items_used && i != 0)
        {
          free_menubar_widget_value_tree (first_wv);
-         menu_items = Qnil;
-
+         discard_menu_items ();
+          unbind_to (specpdl_count, Qnil);
          return;
        }
 
+      f->menu_bar_vector = menu_items;
+      f->menu_bar_items_used = menu_items_used;
+
+      /* This undoes save_menu_items.  */
+      unbind_to (specpdl_count, Qnil);
+
       /* Now GC cannot happen during the lifetime of the widget_value,
         so it's safe to store data from a Lisp_String, as long as
         local copies are made when the actual menu is created.
@@ -794,10 +801,6 @@
          update_submenu_strings (wv->contents);
          wv = wv->next;
        }
-
-      f->menu_bar_vector = menu_items;
-      f->menu_bar_items_used = menu_items_used;
-      menu_items = Qnil;
     }
   else
     {
@@ -955,6 +958,9 @@
 
   *error = NULL;
 
+  if (menu_items_n_panes == 0)
+    return Qnil;
+
   if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
     {
       *error = "Empty menu";
@@ -1104,6 +1110,7 @@
            abort ();
 
          wv->selected = !NILP (selected);
+
           if (!STRINGP (help))
            help = Qnil;
 
@@ -1141,6 +1148,9 @@
       first_wv->contents = wv_title;
     }
 
+  /* No selection has been chosen yet.  */
+  menu_item_selection = 0;
+
   /* Actually create the menu.  */
   current_popup_menu = menu = CreatePopupMenu ();
   fill_in_menu (menu, first_wv->contents);
@@ -1150,9 +1160,6 @@
   pos.y = y;
   ClientToScreen (FRAME_W32_WINDOW (f), &pos);
 
-  /* No selection has been chosen yet.  */
-  menu_item_selection = 0;
-
   /* Display the menu.  */
   menu_item_selection = SendMessage (FRAME_W32_WINDOW (f),
                                     WM_EMACS_TRACKPOPUPMENU,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]