[gtk/matthiasc/for-master: 8/9] immulticontext: Unset client widget on delegate change




commit 91bcf6f0ba49a94c568b5a172c3e03a5081c6a89
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 2 22:24:19 2021 -0400

    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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]