combobox: Use dispose instead of destroy

The destroy vfunc is going away.
This commit is contained in:
Matthias Clasen 2020-05-05 16:47:10 -04:00
parent e0f95844c1
commit 37e381e95d

View File

@ -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 */