[gtk/abolish-destroy: 2/23] combobox: Use dispose instead of destroy



commit 4901fd7ec54234aef07fd59472edb6d8694d3c93
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 5 16:47:10 2020 -0400

    combobox: Use dispose instead of destroy
    
    The destroy vfunc is going away.

 gtk/gtkcombobox.c | 64 ++++++++++++++++++++++---------------------------------
 1 file changed, 26 insertions(+), 38 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 1edd1661fb..266e1d1afe 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -205,7 +205,6 @@ static void     gtk_combo_box_cell_editable_init   (GtkCellEditableIface *iface)
 static void     gtk_combo_box_constructed          (GObject          *object);
 static void     gtk_combo_box_dispose              (GObject          *object);
 static void     gtk_combo_box_unmap                (GtkWidget        *widget);
-static void     gtk_combo_box_destroy              (GtkWidget        *widget);
 
 static void     gtk_combo_box_set_property         (GObject         *object,
                                                     guint            prop_id,
@@ -412,7 +411,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
   widget_class->measure = gtk_combo_box_measure;
   widget_class->size_allocate = gtk_combo_box_size_allocate;
   widget_class->unmap = gtk_combo_box_unmap;
-  widget_class->destroy = gtk_combo_box_destroy;
   widget_class->compute_expand = gtk_combo_box_compute_expand;
 
   object_class = (GObjectClass *)klass;
@@ -2285,42 +2283,6 @@ gtk_combo_box_unmap (GtkWidget *widget)
   GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unmap (widget);
 }
 
-static void
-gtk_combo_box_destroy (GtkWidget *widget)
-{
-  GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
-  GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
-
-  if (priv->popup_idle_id > 0)
-    {
-      g_source_remove (priv->popup_idle_id);
-      priv->popup_idle_id = 0;
-    }
-
-  if (priv->box)
-    {
-      /* destroy things (unparent will kill the latest ref from us)
-       * last unref on button will destroy the arrow
-       */
-      gtk_widget_unparent (priv->box);
-      priv->box = NULL;
-      priv->button = NULL;
-      priv->arrow = NULL;
-      priv->child = NULL;
-      priv->cell_view = NULL;
-    }
-
-  if (priv->row_separator_destroy)
-    priv->row_separator_destroy (priv->row_separator_data);
-
-  priv->row_separator_func = NULL;
-  priv->row_separator_data = NULL;
-  priv->row_separator_destroy = NULL;
-
-  GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->destroy (widget);
-  priv->cell_view = NULL;
-}
-
 static void
 gtk_combo_box_entry_contents_changed (GtkEntry *entry,
                                       gpointer  user_data)
@@ -2429,6 +2391,32 @@ gtk_combo_box_dispose (GObject* object)
   GtkComboBox *combo_box = GTK_COMBO_BOX (object);
   GtkComboBoxPrivate *priv = gtk_combo_box_get_instance_private (combo_box);
 
+  if (priv->popup_idle_id > 0)
+    {
+      g_source_remove (priv->popup_idle_id);
+      priv->popup_idle_id = 0;
+    }
+
+  if (priv->box)
+    {
+      /* destroy things (unparent will kill the latest ref from us)
+       * last unref on button will destroy the arrow
+       */
+      gtk_widget_unparent (priv->box);
+      priv->box = NULL;
+      priv->button = NULL;
+      priv->arrow = NULL;
+      priv->child = NULL;
+      priv->cell_view = NULL;
+    }
+
+  if (priv->row_separator_destroy)
+    priv->row_separator_destroy (priv->row_separator_data);
+
+  priv->row_separator_func = NULL;
+  priv->row_separator_data = NULL;
+  priv->row_separator_destroy = NULL;
+
   if (priv->popup_widget)
     {
       /* Stop menu destruction triggering toggle on a now-invalid button */


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