[gtk/wip/baedert/for-master: 74/74] Revert "container: Stop remove()ing all widgets in dispose"
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 74/74] Revert "container: Stop remove()ing all widgets in dispose"
- Date: Sat, 5 Oct 2019 09:44:35 +0000 (UTC)
commit c4c9858523aee701a6966e57e36e95704879ea15
Author: Timm Bäder <mail baedert org>
Date: Sat Oct 5 11:39:34 2019 +0200
Revert "container: Stop remove()ing all widgets in dispose"
This reverts commit 521aff4cfe0fe8822a826bce0e0b74fd4012a7c6.
gtk/gtkbin.c | 13 -------------
gtk/gtkbox.c | 19 -------------------
gtk/gtkcontainer.c | 2 ++
gtk/gtkframe.c | 12 ------------
gtk/gtkgrid.c | 19 -------------------
gtk/gtkheaderbar.c | 26 ++++++++++----------------
gtk/gtklistbox.c | 19 -------------------
gtk/gtkmenu.c | 6 ++----
gtk/gtkmodelbutton.c | 2 +-
gtk/gtkoverlay.c | 22 ----------------------
gtk/gtkpaned.c | 12 ------------
gtk/gtkpathbar.c | 11 -----------
gtk/gtkprintunixdialog.c | 2 +-
gtk/gtktoolbar.c | 11 +----------
14 files changed, 17 insertions(+), 159 deletions(-)
---
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index bff4b41d83..386ac55fd8 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -80,25 +80,12 @@ gtk_bin_size_allocate (GtkWidget *widget,
}, baseline);
}
-static void
-gtk_bin_dispose (GObject *object)
-{
- GtkBinPrivate *priv = gtk_bin_get_instance_private (GTK_BIN (object));
-
- g_clear_pointer (&priv->child, gtk_widget_unparent);
-
- G_OBJECT_CLASS (gtk_bin_parent_class)->dispose (object);
-}
-
static void
gtk_bin_class_init (GtkBinClass *class)
{
- GObjectClass *object_class = (GObjectClass *) class;
GtkWidgetClass *widget_class = (GtkWidgetClass*) class;
GtkContainerClass *container_class = (GtkContainerClass*) class;
- object_class->dispose = gtk_bin_dispose;
-
widget_class->measure = gtk_bin_measure;
widget_class->size_allocate = gtk_bin_size_allocate;
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 1e581fa904..f6195dbfbb 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -117,24 +117,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
G_ADD_PRIVATE (GtkBox)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
-static void
-gtk_box_dispose (GObject *object)
-{
- GtkWidget *child;
-
- child = gtk_widget_get_first_child (GTK_WIDGET (object));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_widget_unparent (child);
-
- child = next;
- }
-
- G_OBJECT_CLASS (gtk_box_parent_class)->dispose (object);
-}
-
static void
gtk_box_class_init (GtkBoxClass *class)
{
@@ -142,7 +124,6 @@ gtk_box_class_init (GtkBoxClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
- object_class->dispose = gtk_box_dispose;
object_class->set_property = gtk_box_set_property;
object_class->get_property = gtk_box_get_property;
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 9850ca837a..4b89b6b8a3 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -251,6 +251,8 @@ gtk_container_dispose (GObject *object)
if (priv->restyle_pending)
priv->restyle_pending = FALSE;
+ gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
+
G_OBJECT_CLASS (gtk_container_parent_class)->dispose (object);
}
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index 8460df1c84..b5a2aa8a6e 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -149,17 +149,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkFrame, gtk_frame, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_frame_buildable_init))
-
-static void
-gtk_frame_dispose (GObject *object)
-{
- GtkFramePrivate *priv = gtk_frame_get_instance_private (GTK_FRAME (object));
-
- g_clear_pointer (&priv->label_widget, gtk_widget_unparent);
-
- G_OBJECT_CLASS (gtk_frame_parent_class)->dispose (object);
-}
-
static void
gtk_frame_class_init (GtkFrameClass *class)
{
@@ -171,7 +160,6 @@ gtk_frame_class_init (GtkFrameClass *class)
widget_class = GTK_WIDGET_CLASS (class);
container_class = GTK_CONTAINER_CLASS (class);
- gobject_class->dispose = gtk_frame_dispose;
gobject_class->set_property = gtk_frame_set_property;
gobject_class->get_property = gtk_frame_get_property;
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 0887a9f605..a0c3ac107e 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -325,24 +325,6 @@ gtk_grid_child_type (GtkContainer *container)
return GTK_TYPE_WIDGET;
}
-static void
-gtk_grid_dispose (GObject *object)
-{
- GtkWidget *child;
-
- child = gtk_widget_get_first_child (GTK_WIDGET (object));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_widget_unparent (child);
-
- child = next;
- }
-
- G_OBJECT_CLASS (gtk_grid_parent_class)->dispose (object);
-}
-
static void
gtk_grid_class_init (GtkGridClass *class)
{
@@ -350,7 +332,6 @@ gtk_grid_class_init (GtkGridClass *class)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
- object_class->dispose = gtk_grid_dispose;
object_class->get_property = gtk_grid_get_property;
object_class->set_property = gtk_grid_set_property;
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index 81fc856710..3b3f06e43e 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -271,27 +271,21 @@ _gtk_header_bar_update_separator_visibility (GtkHeaderBar *bar)
GList *l;
GList *children;
- if (priv->start_box)
+ children = gtk_container_get_children (GTK_CONTAINER (priv->start_box));
+ for (l = children; l; l = l->next)
{
- children = gtk_container_get_children (GTK_CONTAINER (priv->start_box));
- for (l = children; l; l = l->next)
- {
- if (l->data != priv->titlebar_start_box && gtk_widget_get_visible (l->data))
- have_visible_at_start = TRUE;
- }
- g_list_free (children);
+ if (l->data != priv->titlebar_start_box && gtk_widget_get_visible (l->data))
+ have_visible_at_start = TRUE;
}
+ g_list_free (children);
- if (priv->end_box)
+ children = gtk_container_get_children (GTK_CONTAINER (priv->end_box));
+ for (l = children; l; l = l->next)
{
- children = gtk_container_get_children (GTK_CONTAINER (priv->end_box));
- for (l = children; l; l = l->next)
- {
- if (l->data != priv->titlebar_end_box && gtk_widget_get_visible (l->data))
- have_visible_at_end = TRUE;
- }
- g_list_free (children);
+ if (l->data != priv->titlebar_end_box && gtk_widget_get_visible (l->data))
+ have_visible_at_end = TRUE;
}
+ g_list_free (children);
if (priv->titlebar_start_separator != NULL)
gtk_widget_set_visible (priv->titlebar_start_separator, have_visible_at_start);
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 2af79aeba1..857da444c7 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -433,24 +433,6 @@ gtk_list_box_finalize (GObject *obj)
G_OBJECT_CLASS (gtk_list_box_parent_class)->finalize (obj);
}
-static void
-gtk_list_box_dispose (GObject *object)
-{
- GtkWidget *child;
-
- child = gtk_widget_get_first_child (GTK_WIDGET (object));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_widget_unparent (child);
-
- child = next;
- }
-
- G_OBJECT_CLASS (gtk_list_box_parent_class)->dispose (object);
-}
-
static void
gtk_list_box_class_init (GtkListBoxClass *klass)
{
@@ -463,7 +445,6 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
object_class->get_property = gtk_list_box_get_property;
object_class->set_property = gtk_list_box_set_property;
- object_class->dispose = gtk_list_box_dispose;
object_class->finalize = gtk_list_box_finalize;
widget_class->show = gtk_list_box_show;
widget_class->focus = gtk_list_box_focus;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 6e159b318a..b32f8f004f 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -893,16 +893,14 @@ gtk_menu_dispose (GObject *object)
}
g_clear_object (&priv->accel_group);
+ g_clear_pointer (&priv->heights, g_free);
+ G_OBJECT_CLASS (gtk_menu_parent_class)->dispose (object);
if (priv->toplevel)
{
g_signal_handlers_disconnect_by_func (priv->toplevel, moved_to_rect_cb, menu);
gtk_widget_destroy (priv->toplevel);
}
-
- g_clear_pointer (&priv->heights, g_free);
-
- G_OBJECT_CLASS (gtk_menu_parent_class)->dispose (object);
}
static void
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index 7ce9b7284f..9f41a25ce6 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -945,12 +945,12 @@ gtk_model_button_finalize (GObject *object)
{
GtkModelButton *button = GTK_MODEL_BUTTON (object);
- g_clear_object (&button->action_helper);
g_clear_pointer (&button->image, gtk_widget_unparent);
g_clear_pointer (&button->label, gtk_widget_unparent);
g_clear_pointer (&button->start_box, gtk_widget_unparent);
g_clear_pointer (&button->accel_label, gtk_widget_unparent);
g_clear_pointer (&button->end_indicator, gtk_widget_unparent);
+ g_clear_object (&button->action_helper);
g_free (button->accel);
g_clear_pointer (&button->popover, gtk_widget_unparent);
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 6217509935..f23982221e 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -271,26 +271,6 @@ gtk_overlay_snapshot (GtkWidget *widget,
}
}
-static void
-gtk_overlay_dispose (GObject *object)
-{
- GtkWidget *child;
-
- child = gtk_widget_get_first_child (GTK_WIDGET (object));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_widget_unparent (child);
-
- child = next;
- }
-
- _gtk_bin_set_child (GTK_BIN (object), NULL);
-
- G_OBJECT_CLASS (gtk_overlay_parent_class)->dispose (object);
-}
-
static void
gtk_overlay_class_init (GtkOverlayClass *klass)
{
@@ -298,8 +278,6 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
- object_class->dispose = gtk_overlay_dispose;
-
widget_class->snapshot = gtk_overlay_snapshot;
container_class->add = gtk_overlay_add;
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 708ab43fac..1bf644fa8f 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -332,17 +332,6 @@ gtk_paned_handle_contains (GtkGizmo *handle,
return graphene_rect_contains_point (&area, &GRAPHENE_POINT_INIT (x, y));
}
-static void
-gtk_paned_dispose (GObject *object)
-{
- GtkPanedPrivate *priv = gtk_paned_get_instance_private (GTK_PANED (object));
-
- g_clear_pointer (&priv->child1, gtk_widget_unparent);
- g_clear_pointer (&priv->child2, gtk_widget_unparent);
-
- G_OBJECT_CLASS (gtk_paned_parent_class)->dispose (object);
-}
-
static void
gtk_paned_class_init (GtkPanedClass *class)
{
@@ -359,7 +348,6 @@ gtk_paned_class_init (GtkPanedClass *class)
object_class->set_property = gtk_paned_set_property;
object_class->get_property = gtk_paned_get_property;
- object_class->dispose = gtk_paned_dispose;
object_class->finalize = gtk_paned_finalize;
widget_class->measure = gtk_paned_measure;
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index dff05f9e32..5bc9906888 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -352,23 +352,12 @@ gtk_path_bar_dispose (GObject *object)
{
GtkPathBar *path_bar = GTK_PATH_BAR (object);
GtkPathBarPrivate *priv = gtk_path_bar_get_instance_private (path_bar);
- GtkWidget *child;
remove_settings_signal (path_bar, gtk_widget_get_display (GTK_WIDGET (object)));
priv->get_info_cancellable = NULL;
cancel_all_cancellables (path_bar);
- child = gtk_widget_get_first_child (GTK_WIDGET (object));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_widget_unparent (child);
-
- child = next;
- }
-
G_OBJECT_CLASS (gtk_path_bar_parent_class)->dispose (object);
}
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 432cc57a11..74c2528464 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -826,7 +826,7 @@ gtk_print_unix_dialog_constructed (GObject *object)
GtkWidget *button, *parent;
button = gtk_dialog_get_widget_for_response (GTK_DIALOG (object), GTK_RESPONSE_APPLY);
g_object_ref (button);
- parent = gtk_widget_get_parent (button);
+ parent = gtk_widget_get_ancestor (button, GTK_TYPE_HEADER_BAR);
gtk_container_remove (GTK_CONTAINER (parent), button);
gtk_header_bar_pack_end (GTK_HEADER_BAR (parent), button);
g_object_unref (button);
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index ec602d79a0..6d6d88e1ed 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -2517,17 +2517,8 @@ gtk_toolbar_dispose (GObject *object)
{
GtkToolbar *toolbar = GTK_TOOLBAR (object);
GtkToolbarPrivate *priv = toolbar->priv;
- GtkWidget *child;
- child = gtk_widget_get_first_child (GTK_WIDGET (object));
- while (child)
- {
- GtkWidget *next = gtk_widget_get_next_sibling (child);
-
- gtk_widget_unparent (child);
-
- child = next;
- }
+ g_clear_pointer (&priv->arrow_button, gtk_widget_unparent);
if (priv->menu)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]