changeset 5714:489e76b85828

When an error is encountered while converting a Lisp menu specification to its internal form, don't fail an assert(). Instead, return 0 to skip the fault menu and show any errors in *Warnings*.
author Jerry James <james@xemacs.org>
date Mon, 21 Jan 2013 10:17:55 -0700
parents 8b5bdc8aebfd
children 68f8d295be49
files src/ChangeLog src/menubar-x.c
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Jan 05 02:11:23 2013 +0900
+++ b/src/ChangeLog	Mon Jan 21 10:17:55 2013 -0700
@@ -1,3 +1,9 @@
+2013-01-16  Jerry James  <james@xemacs.org>
+
+	* menubar-x.c (set_frame_menubar): when a menubar specification has an
+	error, don't fail an assert() and bring XEmacs down.  Instead, return
+	0 to skip the faulty menu and show any errors in *Warnings*.
+
 2013-01-04  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* XEmacs 21.5.33 "horseradish" is released.
--- a/src/menubar-x.c	Sat Jan 05 02:11:23 2013 +0900
+++ b/src/menubar-x.c	Mon Jan 21 10:17:55 2013 -0700
@@ -516,6 +516,9 @@
     }
 }
 
+/* Returns the converted menubar, or NULL if an error is encountered while
+ * converting the Lisp menu specification.
+ */
 static widget_value *
 compute_menubar_data (struct frame *f, Lisp_Object menubar, int deep_p)
 {
@@ -573,7 +576,8 @@
     menubar_visible = !NILP (w->menubar_visible_p);
 
   data = compute_menubar_data (f, menubar, deep_p);
-  assert (data && (data->next || data->contents));
+  if (!data || (!data->next && !data->contents))
+    return 0;
 
   if (!FRAME_X_MENUBAR_ID (f))
     FRAME_X_MENUBAR_ID (f) = new_lwlib_id ();
@@ -594,6 +598,8 @@
 	{
 	  free_popup_widget_value_tree (data);
 	  data = compute_menubar_data (f, menubar, 1);
+	  if (!data || (!data->next && !data->contents))
+	    return 0;
 	}