diff options
| author | Po Lu | 2022-12-04 21:54:52 +0800 |
|---|---|---|
| committer | Po Lu | 2022-12-04 21:56:23 +0800 |
| commit | 3e00e50ee3d54537b8390b8d386387d01ae7553d (patch) | |
| tree | 7948478e0f6344fdd4efa3aa37c640537b09d430 /src | |
| parent | a51743dbcb793d1c02f1f40b107e752c2a095ab0 (diff) | |
| download | emacs-3e00e50ee3d54537b8390b8d386387d01ae7553d.tar.gz emacs-3e00e50ee3d54537b8390b8d386387d01ae7553d.zip | |
Fix potential crash deselecting for property change notifications
* src/xselect.c (x_cancel_selection_transfer): Catch errors
around XSelectInput.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xselect.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/xselect.c b/src/xselect.c index 120a5a163e2..121b17df1b0 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -794,8 +794,16 @@ x_cancel_selection_transfer (struct transfer *transfer) | |||
| 794 | transfer->requestor) | 794 | transfer->requestor) |
| 795 | /* This can be called from x_delete_display. */ | 795 | /* This can be called from x_delete_display. */ |
| 796 | && transfer->dpyinfo->display) | 796 | && transfer->dpyinfo->display) |
| 797 | XSelectInput (transfer->dpyinfo->display, | 797 | { |
| 798 | transfer->requestor, NoEventMask); | 798 | /* Ignore errors generated by the change window request in case |
| 799 | the window has gone away. */ | ||
| 800 | block_input (); | ||
| 801 | x_ignore_errors_for_next_request (transfer->dpyinfo); | ||
| 802 | XSelectInput (transfer->dpyinfo->display, | ||
| 803 | transfer->requestor, NoEventMask); | ||
| 804 | x_stop_ignoring_errors (transfer->dpyinfo); | ||
| 805 | unblock_input (); | ||
| 806 | } | ||
| 799 | 807 | ||
| 800 | cancel_atimer (transfer->timeout); | 808 | cancel_atimer (transfer->timeout); |
| 801 | xfree (transfer); | 809 | xfree (transfer); |