[mutter/wip/carlosg/null-preedit] wayland: Handle NULL preedit text
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/null-preedit] wayland: Handle NULL preedit text
- Date: Tue, 24 Mar 2020 15:55:21 +0000 (UTC)
commit c98902701356e0d0746bc40a1095f9001e8404c1
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Mar 24 16:52:55 2020 +0100
wayland: Handle NULL preedit text
The preedit text may be NULL (eg. when unsetting it). This started
causing crashes since commit db9b60cc635, duh.
Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1132
src/wayland/meta-wayland-text-input.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c
index deff44c1b..4e7d18b25 100644
--- a/src/wayland/meta-wayland-text-input.c
+++ b/src/wayland/meta-wayland-text-input.c
@@ -207,10 +207,12 @@ meta_wayland_text_input_focus_set_preedit_text (ClutterInputFocus *focus,
{
MetaWaylandTextInput *text_input;
struct wl_resource *resource;
- gsize pos;
+ gsize pos = 0;
text_input = META_WAYLAND_TEXT_INPUT_FOCUS (focus)->text_input;
- pos = g_utf8_offset_to_pointer (text, cursor) - text;
+
+ if (text)
+ pos = g_utf8_offset_to_pointer (text, cursor) - text;
wl_resource_for_each (resource, &text_input->focus_resource_list)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]