From 797e79d3c7aecf27b04ed100581345ebc0f70ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 25 Dec 2020 22:04:19 +0100 Subject: [PATCH] =?UTF-8?q?ime:=20don=E2=80=99t=20call=20text-input=20func?= =?UTF-8?q?tions=20when=20it=20isn=E2=80=99t=20available?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #259 --- CHANGELOG.md | 2 ++ ime.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f174cd9..b6b804ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ * Exit when the client application terminates, not when the TTY file descriptor is closed. +* Crash on compositors not implementing the _text input_ interface + (https://codeberg.org/dnkl/foot/issues/259). ### Security diff --git a/ime.c b/ime.c index 24237d69..9e2699f2 100644 --- a/ime.c +++ b/ime.c @@ -327,6 +327,9 @@ ime_reset(struct seat *seat) void ime_enable(struct seat *seat) { + if (unlikely(seat->wayl->text_input_manager == NULL)) + return; + struct terminal *term = seat->kbd_focus; assert(term != NULL); @@ -348,6 +351,9 @@ ime_enable(struct seat *seat) void ime_disable(struct seat *seat) { + if (unlikely(seat->wayl->text_input_manager == NULL)) + return; + ime_reset(seat); zwp_text_input_v3_disable(seat->wl_text_input);