Mercurial > hg > xemacs-beta
comparison src/menubar-x.c @ 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 | 308d34e9f07d |
children | 68f8d295be49 |
comparison
equal
deleted
inserted
replaced
5713:8b5bdc8aebfd | 5714:489e76b85828 |
---|---|
514 DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (XDEVICE (FRAME_DEVICE (f))) = | 514 DEVICE_X_GLOBAL_MOUSE_TIMESTAMP (XDEVICE (FRAME_DEVICE (f))) = |
515 x_focus_timestamp_really_sucks_fix_me_better; | 515 x_focus_timestamp_really_sucks_fix_me_better; |
516 } | 516 } |
517 } | 517 } |
518 | 518 |
519 /* Returns the converted menubar, or NULL if an error is encountered while | |
520 * converting the Lisp menu specification. | |
521 */ | |
519 static widget_value * | 522 static widget_value * |
520 compute_menubar_data (struct frame *f, Lisp_Object menubar, int deep_p) | 523 compute_menubar_data (struct frame *f, Lisp_Object menubar, int deep_p) |
521 { | 524 { |
522 if (NILP (menubar)) | 525 if (NILP (menubar)) |
523 return 0; | 526 return 0; |
571 } | 574 } |
572 else | 575 else |
573 menubar_visible = !NILP (w->menubar_visible_p); | 576 menubar_visible = !NILP (w->menubar_visible_p); |
574 | 577 |
575 data = compute_menubar_data (f, menubar, deep_p); | 578 data = compute_menubar_data (f, menubar, deep_p); |
576 assert (data && (data->next || data->contents)); | 579 if (!data || (!data->next && !data->contents)) |
580 return 0; | |
577 | 581 |
578 if (!FRAME_X_MENUBAR_ID (f)) | 582 if (!FRAME_X_MENUBAR_ID (f)) |
579 FRAME_X_MENUBAR_ID (f) = new_lwlib_id (); | 583 FRAME_X_MENUBAR_ID (f) = new_lwlib_id (); |
580 | 584 |
581 /***** now store into the menubar widget, creating it if necessary *****/ | 585 /***** now store into the menubar widget, creating it if necessary *****/ |
592 components are created with the right type. */ | 596 components are created with the right type. */ |
593 if (!deep_p) | 597 if (!deep_p) |
594 { | 598 { |
595 free_popup_widget_value_tree (data); | 599 free_popup_widget_value_tree (data); |
596 data = compute_menubar_data (f, menubar, 1); | 600 data = compute_menubar_data (f, menubar, 1); |
601 if (!data || (!data->next && !data->contents)) | |
602 return 0; | |
597 } | 603 } |
598 | 604 |
599 | 605 |
600 FRAME_X_MENUBAR_WIDGET (f) = | 606 FRAME_X_MENUBAR_WIDGET (f) = |
601 lw_create_widget ("menubar", "menubar", id, data, parent, | 607 lw_create_widget ("menubar", "menubar", id, data, parent, |