diff options
| author | Po Lu | 2022-03-26 12:01:58 +0000 |
|---|---|---|
| committer | Po Lu | 2022-03-26 12:01:58 +0000 |
| commit | 0549adb4bb7c31c99f99bd295a7cb65b380b83f8 (patch) | |
| tree | 5fe99dc088651ddb4d196b1763bda8d7a8ba9bd8 /src | |
| parent | a3ed1d2590c2acd041dfc9a783daa240fddfc11d (diff) | |
| download | emacs-0549adb4bb7c31c99f99bd295a7cb65b380b83f8.tar.gz emacs-0549adb4bb7c31c99f99bd295a7cb65b380b83f8.zip | |
Fix crash when timer signals or throws inside a popup menu on Haiku
* src/haikumenu.c (haiku_process_pending_signals_for_menu_1)
(haiku_process_pending_signals_for_menu_2): New functions.
(haiku_process_pending_signals_for_menu): Catch non local exits
around `timer_check'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/haikumenu.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/haikumenu.c b/src/haikumenu.c index 8da00ffcb05..4cee69826da 100644 --- a/src/haikumenu.c +++ b/src/haikumenu.c | |||
| @@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 29 | #include "haiku_support.h" | 29 | #include "haiku_support.h" |
| 30 | 30 | ||
| 31 | static Lisp_Object *volatile menu_item_selection; | 31 | static Lisp_Object *volatile menu_item_selection; |
| 32 | static struct timespec menu_timer_timespec; | ||
| 32 | 33 | ||
| 33 | int popup_activated_p = 0; | 34 | int popup_activated_p = 0; |
| 34 | 35 | ||
| @@ -340,12 +341,35 @@ haiku_menu_show_help (void *help, void *data) | |||
| 340 | show_help_echo (Qnil, Qnil, Qnil, Qnil); | 341 | show_help_echo (Qnil, Qnil, Qnil, Qnil); |
| 341 | } | 342 | } |
| 342 | 343 | ||
| 344 | static Lisp_Object | ||
| 345 | haiku_process_pending_signals_for_menu_1 (void *ptr) | ||
| 346 | { | ||
| 347 | menu_timer_timespec = timer_check (); | ||
| 348 | |||
| 349 | return Qnil; | ||
| 350 | } | ||
| 351 | |||
| 352 | static Lisp_Object | ||
| 353 | haiku_process_pending_signals_for_menu_2 (enum nonlocal_exit exit, Lisp_Object error) | ||
| 354 | { | ||
| 355 | menu_timer_timespec.tv_sec = 0; | ||
| 356 | menu_timer_timespec.tv_nsec = -1; | ||
| 357 | |||
| 358 | return Qnil; | ||
| 359 | } | ||
| 360 | |||
| 343 | static struct timespec | 361 | static struct timespec |
| 344 | haiku_process_pending_signals_for_menu (void) | 362 | haiku_process_pending_signals_for_menu (void) |
| 345 | { | 363 | { |
| 346 | process_pending_signals (); | 364 | process_pending_signals (); |
| 347 | 365 | ||
| 348 | return timer_check (); | 366 | /* The original idea was to let timers throw so that timeouts can |
| 367 | work correctly, but there's no way to pop down a BPopupMenu | ||
| 368 | that's currently popped up. */ | ||
| 369 | internal_catch_all (haiku_process_pending_signals_for_menu_1, NULL, | ||
| 370 | haiku_process_pending_signals_for_menu_2); | ||
| 371 | |||
| 372 | return menu_timer_timespec; | ||
| 349 | } | 373 | } |
| 350 | 374 | ||
| 351 | Lisp_Object | 375 | Lisp_Object |