summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2018-03-13 18:47:10 +0100
committerMarco Trevisan <mail@3v1n0.net>2018-03-13 18:04:28 +0000
commit02a8a491a397a42e342f1745a5074194d524113f (patch)
treefcc30a60965cbd26081c2bb4b0243f8b42591b75
parent1d3d9fe4f5cec61ea2c50efc4c953f63fd617f9e (diff)
downloadnautilus-02a8a491a397a42e342f1745a5074194d524113f.tar.gz
window-slot: Move object cleanup to finalize
(cherry picked from commit f3bc66340ce4c67ddf9c5717714f2e97e6ab12fb)
-rw-r--r--src/nautilus-window-slot.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 53f5262a1..3160c0e95 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2777,6 +2777,18 @@ static void
nautilus_window_slot_dispose (GObject *object)
{
NautilusWindowSlot *self;
+
+ self = NAUTILUS_WINDOW_SLOT (object);
+
+ g_signal_handlers_disconnect_by_data (nautilus_trash_monitor_get (), self);
+
+ G_OBJECT_CLASS (nautilus_window_slot_parent_class)->dispose (object);
+}
+
+static void
+nautilus_window_slot_finalize (GObject *object)
+{
+ NautilusWindowSlot *self;
GtkWidget *widget;
NautilusWindowSlotPrivate *priv;
@@ -2788,41 +2800,31 @@ nautilus_window_slot_dispose (GObject *object)
nautilus_window_slot_remove_extra_location_widgets (self);
- g_signal_handlers_disconnect_by_data (nautilus_trash_monitor_get (), self);
-
if (priv->content_view)
{
widget = GTK_WIDGET (priv->content_view);
gtk_widget_destroy (widget);
- g_object_unref (priv->content_view);
- priv->content_view = NULL;
+ g_clear_object (&priv->content_view);
}
if (priv->new_content_view)
{
widget = GTK_WIDGET (priv->new_content_view);
gtk_widget_destroy (widget);
- g_object_unref (priv->new_content_view);
- priv->new_content_view = NULL;
+ g_clear_object (&priv->new_content_view);
}
nautilus_window_slot_set_viewed_file (self, NULL);
g_clear_object (&priv->location);
g_clear_object (&priv->pending_file_to_activate);
-
- nautilus_file_list_free (priv->pending_selection);
- priv->pending_selection = NULL;
+ g_clear_pointer (&priv->pending_selection, nautilus_file_list_free);
g_clear_object (&priv->current_location_bookmark);
g_clear_object (&priv->last_location_bookmark);
g_clear_object (&priv->slot_action_group);
- if (priv->find_mount_cancellable != NULL)
- {
- g_cancellable_cancel (priv->find_mount_cancellable);
- priv->find_mount_cancellable = NULL;
- }
+ g_clear_pointer (&priv->find_mount_cancellable, g_cancellable_cancel);
if (priv->window)
{
@@ -2830,12 +2832,10 @@ nautilus_window_slot_dispose (GObject *object)
priv->window = NULL;
}
- g_free (priv->title);
- priv->title = NULL;
-
+ g_clear_pointer (&priv->title, g_free);
free_location_change (self);
- G_OBJECT_CLASS (nautilus_window_slot_parent_class)->dispose (object);
+ G_OBJECT_CLASS (nautilus_window_slot_parent_class)->finalize (object);
}
static void
@@ -2875,6 +2875,7 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
klass->handles_location = real_handles_location;
oclass->dispose = nautilus_window_slot_dispose;
+ oclass->finalize = nautilus_window_slot_finalize;
oclass->constructed = nautilus_window_slot_constructed;
oclass->set_property = nautilus_window_slot_set_property;
oclass->get_property = nautilus_window_slot_get_property;