diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-05-25 15:50:29 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-05-25 15:50:29 +0000 |
| commit | 37db94078f07ca852899e041fb9397c97fcc1bde (patch) | |
| tree | b44bba20e807c5a9da7c2dda87c521387fc435ef | |
| parent | doc: foot.ini: fix default key combos for "cursor-right-word" action (diff) | |
| parent | wayland: fdm callback: check return value of wl_display_dispatch_pending() (diff) | |
Merge branch 'handle-display-roundtrip-failure'
Closes #542
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | wayland.c | 21 |
2 files changed, 19 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e5e4bbf4..69c5db1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,6 +126,9 @@ * Rare occurrences where the window did not close when the shell exited. Only seen on FreeBSD (https://codeberg.org/dnkl/foot/issues/534) +* Foot process(es) sometimes remaining, using 100% CPU, when closing + multiple foot windows at the same time + (https://codeberg.org/dnkl/foot/issues/542). ### Security @@ -1126,8 +1126,12 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data) return false; } - while (wl_display_prepare_read(wayl->display) != 0) - wl_display_dispatch_pending(wayl->display); + while (wl_display_prepare_read(wayl->display) != 0) { + if (wl_display_dispatch_pending(wayl->display) < 0) { + LOG_ERRNO("failed to dispatch pending Wayland events"); + return false; + } + } } if (events & EPOLLHUP) { @@ -1589,14 +1593,21 @@ void wayl_roundtrip(struct wayland *wayl) { wl_display_cancel_read(wayl->display); - wl_display_roundtrip(wayl->display); + if (wl_display_roundtrip(wayl->display) < 0) { + LOG_ERRNO("failed to roundtrip Wayland display"); + return; + } /* I suspect the roundtrip above clears the pending queue, and * that prepare_read() will always succeed in the first call. But, * better safe than sorry... */ - while (wl_display_prepare_read(wayl->display) != 0) - wl_display_dispatch_pending(wayl->display); + while (wl_display_prepare_read(wayl->display) != 0) { + if (wl_display_dispatch_pending(wayl->display) < 0) { + LOG_ERRNO("failed to dispatch pending Wayland events"); + return; + } + } wayl_flush(wayl); } |
