aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-21 17:18:35 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-21 17:18:35 +0000
commitee45c48debd186c70860351b5d44bb57d5823706 (patch)
treefbe439ac5aa1d5c7f6b896c675d5d3f1e28f2f2a
parentinput: may get keyboard_exit() event with no focused terminal (diff)
term: shutdown: handle *not* being unmapped
When we're shutting down a terminal, we destroy our Wayland window, and assume that will unmap us. There are cases when this isn't true (most likely when e.g. a screen locker is active, and the unmap is being deferred). Handle by explicitly setting focused to NULL.
-rw-r--r--terminal.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index c4cd8c25..a5c3f82c 100644
--- a/terminal.c
+++ b/terminal.c
@@ -590,6 +590,20 @@ fdm_shutdown(struct fdm *fdm, int fd, int events, void *data)
term->window = NULL;
struct wayland *wayl __attribute__((unused)) = term->wl;
+
+ /*
+ * Normally we'd get unmapped when we destroy the Wayland
+ * above.
+ *
+ * However, it appears that under certain conditions, those events
+ * are deferred (for example, when a screen locker is active), and
+ * thus we can get here without having been unmapped.
+ */
+ if (wayl->focused == term)
+ wayl->focused = NULL;
+ if (wayl->moused == term)
+ wayl->moused = NULL;
+
assert(wayl->focused != term);
assert(wayl->moused != term);