[bijiben/wip/gbsneto/ui-tweaks: 3/5] manager, owncloud: Fix reference management
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben/wip/gbsneto/ui-tweaks: 3/5] manager, owncloud: Fix reference management
- Date: Mon, 5 Jun 2017 12:31:45 +0000 (UTC)
commit a405aa0416a6423ff7260088a2198fce4825a8e4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Jun 4 12:27:56 2017 -0300
manager, owncloud: Fix reference management
References are going crazy! This commit sinks the floating
reference of the GtkImage in ownCloud provider before allow
using it, and make BijiManager stop unreferencing a dead
provider on 'abort'.
src/bjb-settings-dialog.c | 2 +-
src/libbiji/biji-manager.c | 2 --
src/libbiji/provider/biji-own-cloud-provider.c | 9 +++++----
3 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/src/bjb-settings-dialog.c b/src/bjb-settings-dialog.c
index 4d78ebd..6d6c192 100644
--- a/src/bjb-settings-dialog.c
+++ b/src/bjb-settings-dialog.c
@@ -265,7 +265,7 @@ add_child (gpointer provider_info, gpointer user_data)
child, provider_child_free);
- w = g_object_ref (child->icon);
+ w = child->icon;
gtk_container_add (GTK_CONTAINER (box), w);
w = gtk_label_new (child->name);
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index c2ce856..e73941c 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -128,8 +128,6 @@ on_provider_abort_cb (BijiProvider *provider,
info = biji_provider_get_info (provider);
g_hash_table_remove (self->priv->providers, info->unique_id);
-
- g_object_unref (G_OBJECT (provider));
}
/*
diff --git a/src/libbiji/provider/biji-own-cloud-provider.c b/src/libbiji/provider/biji-own-cloud-provider.c
index ed0322e..d528a51 100644
--- a/src/libbiji/provider/biji-own-cloud-provider.c
+++ b/src/libbiji/provider/biji-own-cloud-provider.c
@@ -131,10 +131,10 @@ biji_own_cloud_provider_finalize (GObject *object)
if (self->priv->path != NULL)
g_free (self->priv->path);
- g_object_unref (self->priv->account);
- g_object_unref (self->priv->object);
- g_object_unref (self->priv->info.icon);
- g_object_unref (self->priv->folder);
+ g_clear_object (&self->priv->account);
+ g_clear_object (&self->priv->object);
+ g_clear_object (&self->priv->info.icon);
+ g_clear_object (&self->priv->folder);
g_clear_pointer (&self->priv->info.name, g_free);
g_clear_pointer (&self->priv->info.datasource, g_free);
@@ -795,6 +795,7 @@ biji_own_cloud_provider_constructed (GObject *obj)
{
priv->info.icon = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_INVALID);
gtk_image_set_pixel_size (GTK_IMAGE (priv->info.icon), 48);
+ g_object_ref_sink (priv->info.icon);
}
g_object_unref (icon);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]