aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2026-10-25 11:08:15 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-10-25 11:08:15 +0000
commit152487e494993ad7fb5633a27c7d7ad0f8810ea5 (patch)
tree33d443c7fe2fc787beae9eec92a46d7bdb860505
parentime: reset view and cancel selection on input (diff)
wayland: update_terms_on_monitor(): skip terminals in the process of shutting down
In rare cases, xdg_output_handle_done() may be called while a terminal is shutting down. This triggered a crash in update_terms_for_monitor(), which de-references term->window (which is NULL for terminals shutting down). Closes #2487
-rw-r--r--CHANGELOG.md3
-rw-r--r--wayland.c19
2 files changed, 14 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bcfa0262..d1a25691 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -93,11 +93,14 @@
* Possible memory leak when processing keymap data ([#2482][2482]).
* Word-wise selection sometimes not working properly due to incorrect
selection direction ([#2483][2483]).
+* Crash in `xdg_output_handle_done()` if called when a terminal is in
+ the process of shutting down ([#2487][2487]).
[2432]: https://codeberg.org/dnkl/foot/pulls/2432
[2467]: https://codeberg.org/dnkl/foot/issues/2467
[2482]: https://codeberg.org/dnkl/foot/pulls/2482
[2483]: https://codeberg.org/dnkl/foot/issues/2483
+[2487]: https://codeberg.org/dnkl/foot/issues/2487
### Security
diff --git a/wayland.c b/wayland.c
index f15c1687..a47764e4 100644
--- a/wayland.c
+++ b/wayland.c
@@ -439,14 +439,15 @@ update_term_for_output_change(struct terminal *term)
return;
} else if (term->conf->dpi_aware) {
/*
- * If fonts are sized according to DPI, it is possible for the cell
- * size to remain the same when display scale changes. This will not
- * change the surface buffer dimensions, but will change the logical
- * size of the window. To ensure that the compositor is made aware of
- * the proper logical size, force a resize rather than allowing
- * render_resize() to shortcut the notification if the buffer
- * dimensions remain the same.
- */
+ * If fonts are sized according to DPI, it is possible for the
+ * cell size to remain the same when display scale
+ * changes. This will not change the surface buffer
+ * dimensions, but will change the logical size of the
+ * window. To ensure that the compositor is made aware o the
+ * proper logical size, force a resize rather than allowing
+ * render_resize() to shortcut the notification if the buffer
+ * dimensions remain the same.
+ */
resize_opts |= RESIZE_FORCE;
}
@@ -464,6 +465,8 @@ update_terms_on_monitor(struct monitor *mon)
tll_foreach(wayl->terms, it) {
struct terminal *term = it->item;
+ if (unlikely(term->shutdown.in_progress))
+ continue;
tll_foreach(term->window->on_outputs, it2) {
if (it2->item == mon) {