diff options
| author | Dmitry Antipov | 2013-10-11 19:30:21 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-10-11 19:30:21 +0400 |
| commit | 9428abbf51a05346caf1315130411af1811ba0f7 (patch) | |
| tree | 87eaf5afbaf366e41b5ff55c63237f7c6f550a2f /src | |
| parent | 052bac0bf1f4a61fbd3dec494de60955f60071e2 (diff) | |
| download | emacs-9428abbf51a05346caf1315130411af1811ba0f7.tar.gz emacs-9428abbf51a05346caf1315130411af1811ba0f7.zip | |
* term.c (tty_menu_show): Never return with unbalanced
specpdl. Use eassert for debugging check. Adjust style.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/term.c | 20 |
2 files changed, 16 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a11737a31c9..42650a31c7a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-11 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * term.c (tty_menu_show): Never return with unbalanced | ||
| 4 | specpdl. Use eassert for debugging check. Adjust style. | ||
| 5 | |||
| 1 | 2013-10-11 Eli Zaretskii <eliz@gnu.org> | 6 | 2013-10-11 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * term.c (read_menu_input): Make selection of menu items | 8 | * term.c (read_menu_input): Make selection of menu items |
diff --git a/src/term.c b/src/term.c index 71263d41dd2..b946480cd0c 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -3561,10 +3561,9 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3561 | int dispwidth, dispheight; | 3561 | int dispwidth, dispheight; |
| 3562 | int i, j, lines, maxlines; | 3562 | int i, j, lines, maxlines; |
| 3563 | int maxwidth; | 3563 | int maxwidth; |
| 3564 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); | 3564 | ptrdiff_t specpdl_count; |
| 3565 | 3565 | ||
| 3566 | if (! FRAME_TERMCAP_P (f)) | 3566 | eassert (FRAME_TERMCAP_P (f)); |
| 3567 | emacs_abort (); | ||
| 3568 | 3567 | ||
| 3569 | *error_name = 0; | 3568 | *error_name = 0; |
| 3570 | if (menu_items_n_panes == 0) | 3569 | if (menu_items_n_panes == 0) |
| @@ -3586,7 +3585,7 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3586 | 3585 | ||
| 3587 | /* Don't GC while we prepare and show the menu, because we give the | 3586 | /* Don't GC while we prepare and show the menu, because we give the |
| 3588 | menu functions pointers to the contents of strings. */ | 3587 | menu functions pointers to the contents of strings. */ |
| 3589 | inhibit_garbage_collection (); | 3588 | specpdl_count = inhibit_garbage_collection (); |
| 3590 | 3589 | ||
| 3591 | /* Adjust coordinates to be root-window-relative. */ | 3590 | /* Adjust coordinates to be root-window-relative. */ |
| 3592 | item_x = x += f->left_pos; | 3591 | item_x = x += f->left_pos; |
| @@ -3617,7 +3616,8 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3617 | { | 3616 | { |
| 3618 | tty_menu_destroy (menu); | 3617 | tty_menu_destroy (menu); |
| 3619 | *error_name = "Can't create pane"; | 3618 | *error_name = "Can't create pane"; |
| 3620 | return Qnil; | 3619 | entry = Qnil; |
| 3620 | goto tty_menu_end; | ||
| 3621 | } | 3621 | } |
| 3622 | i += MENU_ITEMS_PANE_LENGTH; | 3622 | i += MENU_ITEMS_PANE_LENGTH; |
| 3623 | 3623 | ||
| @@ -3679,7 +3679,8 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3679 | { | 3679 | { |
| 3680 | tty_menu_destroy (menu); | 3680 | tty_menu_destroy (menu); |
| 3681 | *error_name = "Can't add selection to menu"; | 3681 | *error_name = "Can't add selection to menu"; |
| 3682 | return Qnil; | 3682 | entry = Qnil; |
| 3683 | goto tty_menu_end; | ||
| 3683 | } | 3684 | } |
| 3684 | i += MENU_ITEMS_ITEM_LENGTH; | 3685 | i += MENU_ITEMS_ITEM_LENGTH; |
| 3685 | lines++; | 3686 | lines++; |
| @@ -3696,12 +3697,12 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3696 | x = max (x, 1); | 3697 | x = max (x, 1); |
| 3697 | y = max (y, 1); | 3698 | y = max (y, 1); |
| 3698 | tty_menu_locate (menu, x, y, &ulx, &uly, &width, &height); | 3699 | tty_menu_locate (menu, x, y, &ulx, &uly, &width, &height); |
| 3699 | if (ulx+width > dispwidth) | 3700 | if (ulx + width > dispwidth) |
| 3700 | { | 3701 | { |
| 3701 | x -= (ulx + width) - dispwidth; | 3702 | x -= (ulx + width) - dispwidth; |
| 3702 | ulx = dispwidth - width; | 3703 | ulx = dispwidth - width; |
| 3703 | } | 3704 | } |
| 3704 | if (uly+height > dispheight) | 3705 | if (uly + height > dispheight) |
| 3705 | { | 3706 | { |
| 3706 | y -= (uly + height) - dispheight; | 3707 | y -= (uly + height) - dispheight; |
| 3707 | uly = dispheight - height; | 3708 | uly = dispheight - height; |
| @@ -3807,8 +3808,9 @@ tty_menu_show (struct frame *f, int x, int y, int for_click, int keymaps, | |||
| 3807 | break; | 3808 | break; |
| 3808 | } | 3809 | } |
| 3809 | 3810 | ||
| 3810 | unbind_to (specpdl_count, Qnil); | 3811 | tty_menu_end: |
| 3811 | 3812 | ||
| 3813 | unbind_to (specpdl_count, Qnil); | ||
| 3812 | return entry; | 3814 | return entry; |
| 3813 | } | 3815 | } |
| 3814 | 3816 | ||