size group: Streamline disposal

Remove widgets from their size groups in dispose, without connecting
to ::destroy. The signal handler is not necessary.
This commit is contained in:
Matthias Clasen 2015-09-20 01:22:21 -04:00
parent cd35a14bbb
commit da45d29dbc
2 changed files with 13 additions and 17 deletions

View File

@ -518,13 +518,6 @@ gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group)
return size_group->priv->ignore_hidden;
}
static void
gtk_size_group_widget_destroyed (GtkWidget *widget,
GtkSizeGroup *size_group)
{
gtk_size_group_remove_widget (size_group, widget);
}
/**
* gtk_size_group_add_widget:
* @size_group: a #GtkSizeGroup
@ -540,8 +533,8 @@ gtk_size_group_widget_destroyed (GtkWidget *widget,
* be removed from the size group.
*/
void
gtk_size_group_add_widget (GtkSizeGroup *size_group,
GtkWidget *widget)
gtk_size_group_add_widget (GtkSizeGroup *size_group,
GtkWidget *widget)
{
GtkSizeGroupPrivate *priv;
GSList *groups;
@ -559,10 +552,6 @@ gtk_size_group_add_widget (GtkSizeGroup *size_group,
priv->widgets = g_slist_prepend (priv->widgets, widget);
g_signal_connect (widget, "destroy",
G_CALLBACK (gtk_size_group_widget_destroyed),
size_group);
g_object_ref (size_group);
}
@ -589,10 +578,6 @@ gtk_size_group_remove_widget (GtkSizeGroup *size_group,
g_return_if_fail (g_slist_find (priv->widgets, widget));
g_signal_handlers_disconnect_by_func (widget,
gtk_size_group_widget_destroyed,
size_group);
_gtk_widget_remove_sizegroup (widget, size_group);
priv->widgets = g_slist_remove (priv->widgets, widget);

View File

@ -11999,6 +11999,7 @@ gtk_widget_dispose (GObject *object)
{
GtkWidget *widget = GTK_WIDGET (object);
GtkWidgetPrivate *priv = widget->priv;
GSList *sizegroups;
if (priv->parent)
gtk_container_remove (GTK_CONTAINER (priv->parent), widget);
@ -12016,6 +12017,16 @@ gtk_widget_dispose (GObject *object)
priv->in_destruction = FALSE;
}
sizegroups = _gtk_widget_get_sizegroups (widget);
while (sizegroups)
{
GtkSizeGroup *size_group;
size_group = sizegroups->data;
sizegroups = sizegroups->next;
gtk_size_group_remove_widget (size_group, widget);
}
g_object_set_qdata (object, quark_action_muxer, NULL);
while (priv->attached_windows)