diff options
| author | Eli Zaretskii | 2013-09-21 17:53:04 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-09-21 17:53:04 +0300 |
| commit | f0177f86f745ef86357214b110f9d98e4ed63b7a (patch) | |
| tree | 85f8cbb3a930a39ea84bb02637279b7a783d37eb /src/xmenu.c | |
| parent | e11a3bd1d1848d0a3a2ac21a48360eb628127ed9 (diff) | |
| download | emacs-f0177f86f745ef86357214b110f9d98e4ed63b7a.tar.gz emacs-f0177f86f745ef86357214b110f9d98e4ed63b7a.zip | |
Fix infinite loop in menu input due to block_input.
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 823c63bfc6f..5d1f44e0f5a 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1618,6 +1618,8 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 1618 | return Qnil; | 1618 | return Qnil; |
| 1619 | } | 1619 | } |
| 1620 | 1620 | ||
| 1621 | block_input (); | ||
| 1622 | |||
| 1621 | /* Create a tree of widget_value objects | 1623 | /* Create a tree of widget_value objects |
| 1622 | representing the panes and their items. */ | 1624 | representing the panes and their items. */ |
| 1623 | wv = xmalloc_widget_value (); | 1625 | wv = xmalloc_widget_value (); |
| @@ -1857,6 +1859,7 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 1857 | if (!NILP (subprefix_stack[j])) | 1859 | if (!NILP (subprefix_stack[j])) |
| 1858 | entry = Fcons (subprefix_stack[j], entry); | 1860 | entry = Fcons (subprefix_stack[j], entry); |
| 1859 | } | 1861 | } |
| 1862 | unblock_input (); | ||
| 1860 | return entry; | 1863 | return entry; |
| 1861 | } | 1864 | } |
| 1862 | i += MENU_ITEMS_ITEM_LENGTH; | 1865 | i += MENU_ITEMS_ITEM_LENGTH; |
| @@ -1864,9 +1867,13 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 1864 | } | 1867 | } |
| 1865 | } | 1868 | } |
| 1866 | else if (!for_click) | 1869 | else if (!for_click) |
| 1867 | /* Make "Cancel" equivalent to C-g. */ | 1870 | { |
| 1868 | Fsignal (Qquit, Qnil); | 1871 | unblock_input (); |
| 1872 | /* Make "Cancel" equivalent to C-g. */ | ||
| 1873 | Fsignal (Qquit, Qnil); | ||
| 1874 | } | ||
| 1869 | 1875 | ||
| 1876 | unblock_input (); | ||
| 1870 | return Qnil; | 1877 | return Qnil; |
| 1871 | } | 1878 | } |
| 1872 | 1879 | ||
| @@ -2261,6 +2268,8 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 2261 | return Qnil; | 2268 | return Qnil; |
| 2262 | } | 2269 | } |
| 2263 | 2270 | ||
| 2271 | block_input (); | ||
| 2272 | |||
| 2264 | /* Figure out which root window F is on. */ | 2273 | /* Figure out which root window F is on. */ |
| 2265 | XGetGeometry (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &root, | 2274 | XGetGeometry (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &root, |
| 2266 | &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, | 2275 | &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, |
| @@ -2271,6 +2280,7 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 2271 | if (menu == NULL) | 2280 | if (menu == NULL) |
| 2272 | { | 2281 | { |
| 2273 | *error_name = "Can't create menu"; | 2282 | *error_name = "Can't create menu"; |
| 2283 | unblock_input (); | ||
| 2274 | return Qnil; | 2284 | return Qnil; |
| 2275 | } | 2285 | } |
| 2276 | 2286 | ||
| @@ -2314,6 +2324,7 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 2314 | { | 2324 | { |
| 2315 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); | 2325 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); |
| 2316 | *error_name = "Can't create pane"; | 2326 | *error_name = "Can't create pane"; |
| 2327 | unblock_input (); | ||
| 2317 | return Qnil; | 2328 | return Qnil; |
| 2318 | } | 2329 | } |
| 2319 | i += MENU_ITEMS_PANE_LENGTH; | 2330 | i += MENU_ITEMS_PANE_LENGTH; |
| @@ -2378,6 +2389,7 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 2378 | { | 2389 | { |
| 2379 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); | 2390 | XMenuDestroy (FRAME_X_DISPLAY (f), menu); |
| 2380 | *error_name = "Can't add selection to menu"; | 2391 | *error_name = "Can't add selection to menu"; |
| 2392 | unblock_input (); | ||
| 2381 | return Qnil; | 2393 | return Qnil; |
| 2382 | } | 2394 | } |
| 2383 | i += MENU_ITEMS_ITEM_LENGTH; | 2395 | i += MENU_ITEMS_ITEM_LENGTH; |
| @@ -2504,10 +2516,14 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps, | |||
| 2504 | /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means | 2516 | /* Make "Cancel" equivalent to C-g unless FOR_CLICK (which means |
| 2505 | the menu was invoked with a mouse event as POSITION). */ | 2517 | the menu was invoked with a mouse event as POSITION). */ |
| 2506 | if (! for_click) | 2518 | if (! for_click) |
| 2507 | Fsignal (Qquit, Qnil); | 2519 | { |
| 2520 | unblock_input (); | ||
| 2521 | Fsignal (Qquit, Qnil); | ||
| 2522 | } | ||
| 2508 | break; | 2523 | break; |
| 2509 | } | 2524 | } |
| 2510 | 2525 | ||
| 2526 | unblock_input (); | ||
| 2511 | unbind_to (specpdl_count, Qnil); | 2527 | unbind_to (specpdl_count, Qnil); |
| 2512 | 2528 | ||
| 2513 | return entry; | 2529 | return entry; |