diff options
author | Corey Berla <corey@berla.me> | 2023-01-15 15:24:30 -0800 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2023-01-16 22:06:16 +0000 |
commit | 47b48cb8d1b8d9252c85e814dbc305a125b0b7ec (patch) | |
tree | ced21b8f2a26f4261e6b75a4bae44572239bc5ce | |
parent | a78f58617582520d57f4b20f8440000158eb79fd (diff) | |
download | nautilus-47b48cb8d1b8d9252c85e814dbc305a125b0b7ec.tar.gz |
view-item: Make item_ui a weak pointer
view-item holds a reference for the cell and the cell holds a ref
to the item. In order to break this cycle, let's make item_ui
a weak pointer in view-item. The cell will get freed by the
list factory.
-rw-r--r-- | src/nautilus-view-item.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/nautilus-view-item.c b/src/nautilus-view-item.c index 31c11e3fe..aafea3763 100644 --- a/src/nautilus-view-item.c +++ b/src/nautilus-view-item.c @@ -27,7 +27,6 @@ enum PROP_IS_CUT, PROP_DRAG_ACCEPT, PROP_IS_LOADING, - PROP_ITEM_UI, N_PROPS }; @@ -46,7 +45,7 @@ nautilus_view_item_dispose (GObject *object) { NautilusViewItem *self = NAUTILUS_VIEW_ITEM (object); - g_clear_object (&self->item_ui); + g_clear_weak_pointer (&self->item_ui); G_OBJECT_CLASS (nautilus_view_item_parent_class)->dispose (object); } @@ -101,12 +100,6 @@ nautilus_view_item_get_property (GObject *object, } break; - case PROP_ITEM_UI: - { - g_value_set_object (value, self->item_ui); - } - break; - default: { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -154,12 +147,6 @@ nautilus_view_item_set_property (GObject *object, } break; - case PROP_ITEM_UI: - { - g_set_object (&self->item_ui, g_value_get_object (value)); - } - break; - default: { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -204,10 +191,6 @@ nautilus_view_item_class_init (NautilusViewItemClass *klass) "", "", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - properties[PROP_ITEM_UI] = g_param_spec_object ("item-ui", - "", "", - GTK_TYPE_WIDGET, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); g_object_class_install_properties (object_class, N_PROPS, properties); signals[FILE_CHANGED] = g_signal_new ("file-changed", @@ -295,7 +278,7 @@ nautilus_view_item_set_item_ui (NautilusViewItem *self, { g_return_if_fail (NAUTILUS_IS_VIEW_ITEM (self)); - g_object_set (self, "item-ui", item_ui, NULL); + g_set_weak_pointer (&self->item_ui, item_ui); } void |