summaryrefslogtreecommitdiff
path: root/gtk/gtksidebarrow.c
diff options
context:
space:
mode:
authorDaniel Boles <dboles@src.gnome.org>2017-09-12 21:56:46 +0100
committerDaniel Boles <dboles@src.gnome.org>2017-09-18 23:30:57 +0100
commit383fa87993b590f0ee1d36c70e9e949679ddc4b5 (patch)
tree551c22dbc7469f12da95c84dcbf2ba7d83ceb74b /gtk/gtksidebarrow.c
parentf87dc24867dd54b28d5368925d11203baefd5fb8 (diff)
downloadgtk+-383fa87993b590f0ee1d36c70e9e949679ddc4b5.tar.gz
SidebarRow: Unref CloudProvider on change/finalize
It was never unref()d, either when replacing the existing GObject in set_property(), cleaning up in finalize(), or becoming a placeholder. Fix by using g_set_object() and g_clear_object() to unref as needed. This also drops the check that the newly set object is a valid cloud provider account, as we don’t do the equivalent for any of the other object-typed properties, and Carlos didn’t think this was important. https://bugzilla.gnome.org/show_bug.cgi?id=787600
Diffstat (limited to 'gtk/gtksidebarrow.c')
-rw-r--r--gtk/gtksidebarrow.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/gtk/gtksidebarrow.c b/gtk/gtksidebarrow.c
index 6939bf5a72..65a69f5048 100644
--- a/gtk/gtksidebarrow.c
+++ b/gtk/gtksidebarrow.c
@@ -266,15 +266,10 @@ gtk_sidebar_row_set_property (GObject *object,
break;
case PROP_CLOUD_PROVIDER:
- {
#ifdef HAVE_CLOUDPROVIDERS
- gpointer *object;
- object = g_value_get_object (value);
- if (IS_CLOUD_PROVIDER_ACCOUNT(object))
- self->cloud_provider = g_object_ref (object);
+ g_set_object (&self->cloud_provider, g_value_get_object (value));
#endif
- break;
- }
+ break;
case PROP_PLACEHOLDER:
{
@@ -296,6 +291,7 @@ gtk_sidebar_row_set_property (GObject *object,
g_clear_object (&self->drive);
g_clear_object (&self->volume);
g_clear_object (&self->mount);
+ g_clear_object (&self->cloud_provider);
gtk_container_foreach (GTK_CONTAINER (self),
(GtkCallback) gtk_widget_destroy,
@@ -402,6 +398,7 @@ gtk_sidebar_row_finalize (GObject *object)
g_clear_object (&self->drive);
g_clear_object (&self->volume);
g_clear_object (&self->mount);
+ g_clear_object (&self->cloud_provider);
G_OBJECT_CLASS (gtk_sidebar_row_parent_class)->finalize (object);
}