placesview: plug some memory leaks

The GFile containing the Computer item was not
properly dereferenced, so plug that leak by both
dereferencing it and adding some reference management
on GtkPlacesViewRow.
parent a5e762e6
......@@ -874,6 +874,9 @@ add_computer (GtkPlacesView *view)
NULL);
insert_row (view, row, FALSE);
g_object_unref (icon);
g_object_unref (file);
}
static void
......
......@@ -56,6 +56,16 @@ enum {
static GParamSpec *properties [LAST_PROP];
static void
gtk_places_view_row_finalize (GObject *object)
{
GtkPlacesViewRow *self = GTK_PLACES_VIEW_ROW (object);
g_clear_object (&self->volume);
g_clear_object (&self->mount);
g_clear_object (&self->file);
}
static void
gtk_places_view_row_get_property (GObject *object,
guint prop_id,
......@@ -125,16 +135,16 @@ gtk_places_view_row_set_property (GObject *object,
break;
case PROP_VOLUME:
self->volume = g_value_get_object (value);
g_set_object (&self->volume, g_value_get_object (value));
break;
case PROP_MOUNT:
self->mount = g_value_get_object (value);
g_set_object (&self->mount, g_value_get_object (value));
gtk_widget_set_visible (GTK_WIDGET (self->eject_button), self->mount != NULL);
break;
case PROP_FILE:
self->file = g_value_get_object (value);
g_set_object (&self->file, g_value_get_object (value));
break;
default:
......@@ -148,6 +158,7 @@ gtk_places_view_row_class_init (GtkPlacesViewRowClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = gtk_places_view_row_finalize;
object_class->get_property = gtk_places_view_row_get_property;
object_class->set_property = gtk_places_view_row_set_property;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment