aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c13
-rw-r--r--ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c12
-rw-r--r--ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c12
3 files changed, 28 insertions, 9 deletions
diff --git a/libempathy-gtk/empathy-avatar-chooser.c b/libempathy-gtk/empathy-avatar-chooser.c
index f75b4fdb9..9f2a5e01c 100644
--- a/libempathy-gtk/empathy-avatar-chooser.c
+++ b/libempathy-gtk/empathy-avatar-chooser.c
@@ -123,15 +123,18 @@ get_avatar_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
- TpWeakRef *weak = user_data;
- EmpathyAvatarChooser *self = tp_weak_ref_dup_object (weak);
+ TpWeakRef *wr = user_data;
+ EmpathyAvatarChooser *self = tp_weak_ref_dup_object (wr);
const GArray *avatar;
GdkPixbuf *pixbuf;
gchar *mime_type;
GError *error = NULL;
if (self == NULL)
- goto out;
+ {
+ tp_weak_ref_destroy (wr);
+ return;
+ }
avatar = tp_account_get_avatar_finish (self->priv->account, result, &error);
if (avatar == NULL)
@@ -159,10 +162,10 @@ get_avatar_cb (GObject *source,
g_free (mime_type);
self->priv->changed = FALSE;
- g_object_unref (self);
out:
- tp_weak_ref_destroy (weak);
+ tp_weak_ref_destroy (wr);
+ g_object_unref (self);
}
static void
diff --git a/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c b/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c
index d52b3a360..d07982a3b 100644
--- a/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c
+++ b/ubuntu-online-accounts/cc-plugins/app-plugin/empathy-app-plugin-widget.c
@@ -176,11 +176,18 @@ manager_prepared_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
- EmpathyAppPluginWidget *self = user_data;
+ TpWeakRef *wr = user_data;
+ EmpathyAppPluginWidget *self = tp_weak_ref_dup_object (wr);
TpAccountManager *manager = (TpAccountManager *) source;
GList *accounts;
GError *error = NULL;
+ if (self == NULL)
+ {
+ tp_weak_ref_destroy (wr);
+ return;
+ }
+
if (!tp_proxy_prepare_finish (manager, result, &error))
{
g_debug ("Error preparing Account Manager: %s", error->message);
@@ -215,6 +222,7 @@ manager_prepared_cb (GObject *source,
g_list_free (accounts);
out:
+ tp_weak_ref_destroy (wr);
g_object_unref (self);
}
@@ -241,7 +249,7 @@ empathy_app_plugin_widget_constructed (GObject *object)
* AgAccount */
manager = tp_account_manager_dup ();
tp_proxy_prepare_async (manager, NULL,
- manager_prepared_cb, g_object_ref (self));
+ manager_prepared_cb, tp_weak_ref_new (self, NULL, NULL));
g_object_unref (manager);
}
diff --git a/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c b/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c
index fe3b6fe5e..f76eb5cd4 100644
--- a/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c
+++ b/ubuntu-online-accounts/cc-plugins/empathy-accounts-plugin-widget.c
@@ -291,11 +291,18 @@ manager_prepared_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
- EmpathyAccountsPluginWidget *self = user_data;
+ TpWeakRef *wr = user_data;
+ EmpathyAccountsPluginWidget *self = tp_weak_ref_dup_object (wr);
TpAccountManager *manager = (TpAccountManager *) source;
GList *accounts;
GError *error = NULL;
+ if (self == NULL)
+ {
+ tp_weak_ref_destroy (wr);
+ return;
+ }
+
if (!tp_proxy_prepare_finish (manager, result, &error))
{
g_debug ("Error preparing Account Manager: %s", error->message);
@@ -324,6 +331,7 @@ manager_prepared_cb (GObject *source,
g_list_free (accounts);
out:
+ tp_weak_ref_destroy (wr);
g_object_unref (self);
}
@@ -354,7 +362,7 @@ empathy_accounts_plugin_widget_constructed (GObject *object)
manager = tp_account_manager_dup ();
tp_proxy_prepare_async (manager, NULL,
- manager_prepared_cb, g_object_ref (self));
+ manager_prepared_cb, tp_weak_ref_new (self, NULL, NULL));
g_object_unref (manager);
return;
}