emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106308: Merge from emacs-23; up to r


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106308: Merge from emacs-23; up to r100628
Date: Sun, 06 Nov 2011 15:38:01 -0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106308 [merge]
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Sun 2011-11-06 15:38:01 -0800
message:
  Merge from emacs-23; up to r100628
modified:
  src/ChangeLog
  src/xmenu.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-11-06 21:12:10 +0000
+++ b/src/ChangeLog     2011-11-06 23:38:01 +0000
@@ -1,3 +1,9 @@
+2011-11-06  YAMAMOTO Mitsuharu  <address@hidden>
+
+       * xmenu.c (cleanup_widget_value_tree): New function.
+       (xmenu_show, xdialog_show): Use it in record_unwind_protect instead of
+       calling free_menubar_widget_value_tree directly (Bug#9830).
+
 2011-11-06  Paul Eggert  <address@hidden>
 
        Fix some portability problems with 'inline'.

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2011-09-17 12:19:04 +0000
+++ b/src/xmenu.c       2011-11-06 23:38:01 +0000
@@ -1604,6 +1604,17 @@
 
 #endif /* not USE_GTK */
 
+static Lisp_Object
+cleanup_widget_value_tree (Lisp_Object arg)
+{
+  struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+  widget_value *wv = p->pointer;
+
+  free_menubar_widget_value_tree (wv);
+
+  return Qnil;
+}
+
 Lisp_Object
 xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
            Lisp_Object title, const char **error_name, Time timestamp)
@@ -1618,6 +1629,8 @@
 
   int first_pane;
 
+  int specpdl_count = SPECPDL_INDEX ();
+
   if (! FRAME_X_P (f))
     abort ();
 
@@ -1812,11 +1825,15 @@
   /* No selection has been chosen yet.  */
   menu_item_selection = 0;
 
+  /* Make sure to free the widget_value objects we used to specify the
+     contents even with longjmp.  */
+  record_unwind_protect (cleanup_widget_value_tree,
+                        make_save_value (first_wv, 0));
+
   /* Actually create and show the menu until popped down.  */
   create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
 
-  /* Free the widget_value objects we used to specify the contents.  */
-  free_menubar_widget_value_tree (first_wv);
+  unbind_to (specpdl_count, Qnil);
 
   /* Find the selected item, and its pane, to return
      the proper value.  */
@@ -2003,6 +2020,8 @@
   /* 1 means we've seen the boundary between left-hand elts and right-hand.  */
   int boundary_seen = 0;
 
+  int specpdl_count = SPECPDL_INDEX ();
+
   if (! FRAME_X_P (f))
     abort ();
 
@@ -2116,11 +2135,15 @@
   /* No selection has been chosen yet.  */
   menu_item_selection = 0;
 
+  /* Make sure to free the widget_value objects we used to specify the
+     contents even with longjmp.  */
+  record_unwind_protect (cleanup_widget_value_tree,
+                        make_save_value (first_wv, 0));
+
   /* Actually create and show the dialog.  */
   create_and_show_dialog (f, first_wv);
 
-  /* Free the widget_value objects we used to specify the contents.  */
-  free_menubar_widget_value_tree (first_wv);
+  unbind_to (specpdl_count, Qnil);
 
   /* Find the selected item, and its pane, to return
      the proper value.  */


reply via email to

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