[gtk/wip/matthiasc/popup4: 45/121] text: Adapt to new popover lifecycle



commit 0e0a30d4a14cb159789ad81d6a0b699591906eba
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Mar 21 22:14:03 2019 -0400

    text: Adapt to new popover lifecycle
    
    Unparent the popover in dispose.

 gtk/gtktext.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 143a310013..aba651b8fd 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -156,6 +156,7 @@ struct _GtkTextPrivate
 
   char         *im_module;
 
+  GtkWidget     *emoji_completion;
   GtkTextHandle *text_handle;
   GtkWidget     *selection_bubble;
   guint          selection_bubble_timeout_id;
@@ -1786,8 +1787,11 @@ gtk_text_dispose (GObject *object)
       priv->buffer = NULL;
     }
 
+  g_clear_pointer (&priv->emoji_completion, gtk_widget_unparent);
+
   keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (object)));
   g_signal_handlers_disconnect_by_func (keymap, keymap_direction_changed, self);
+
   G_OBJECT_CLASS (gtk_text_parent_class)->dispose (object);
 }
 
@@ -6629,10 +6633,9 @@ set_enable_emoji_completion (GtkText  *self,
   priv->enable_emoji_completion = value;
 
   if (priv->enable_emoji_completion)
-    g_object_set_data (G_OBJECT (self), "emoji-completion-popup",
-                       gtk_emoji_completion_new (self));
+    priv->emoji_completion = gtk_emoji_completion_new (self);
   else
-    g_object_set_data (G_OBJECT (self), "emoji-completion-popup", NULL);
+    g_clear_pointer (&priv->emoji_completion, gtk_widget_unparent);
 
   g_object_notify_by_pspec (G_OBJECT (self), text_props[PROP_ENABLE_EMOJI_COMPLETION]);
 }


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