[gtk/wip/otte/matthiasc/popup2: 56/92] text: Adapt to new popover lifecycle



commit 02fd69d0ad11170035c0e69e194c8522a18a97b8
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 fb9c7fb244..11ddcc74c4 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;
@@ -1763,8 +1764,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);
 }
 
@@ -6583,10 +6587,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]