From 3c4c7896fc81a92634818c7ebb3ad9d84f62e2d5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 2 Apr 2021 22:24:19 -0400 Subject: [PATCH] immulticontext: Unset client widget on delegate change Forgetting to do so was causing the Wayland im context to leave behind a dead event controller. This was showing up as a crash when closing the inspector after changing the im-module property of a GtkText widget. The crash was delayed until closing the inspector because the inspector keeps a ref on the event controllers of the currently shown widget. --- gtk/gtkimmulticontext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c index 40b80d42d4..f26f1dd05c 100644 --- a/gtk/gtkimmulticontext.c +++ b/gtk/gtkimmulticontext.c @@ -205,6 +205,9 @@ gtk_im_multicontext_set_delegate (GtkIMMulticontext *multicontext, gtk_im_multicontext_delete_surrounding_cb, multicontext); + if (priv->client_widget) + gtk_im_context_set_client_widget (priv->delegate, NULL); + g_object_unref (priv->delegate); priv->delegate = NULL;