[gtk+] size group: Streamline disposal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] size group: Streamline disposal
- Date: Wed, 23 Sep 2015 11:08:50 +0000 (UTC)
commit da45d29dbcad003a6c8435c0790a4ca61b953269
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Sep 20 01:22:21 2015 -0400
size group: Streamline disposal
Remove widgets from their size groups in dispose, without connecting
to ::destroy. The signal handler is not necessary.
gtk/gtksizegroup.c | 19 ++-----------------
gtk/gtkwidget.c | 11 +++++++++++
2 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index db3de65..8e1e33f 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -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);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 8dd39ce..a97cd76 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]