aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-08-09 20:10:59 +0800
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-08-14 23:20:28 +0800
commit77ea9d56fb15dfd6edb1554ba31c42a7789d62d1 (patch)
tree03dc3d971428d312a4260fb578a86482599bb90e /libempathy-gtk
parentd2b704165e9bf015400b72e95d443a67ebc3060e (diff)
downloadgsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.tar
gsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.tar.gz
gsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.tar.bz2
gsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.tar.lz
gsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.tar.xz
gsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.tar.zst
gsoc2013-empathy-77ea9d56fb15dfd6edb1554ba31c42a7789d62d1.zip
Use TpWeakRef when user_data of an async call is a widget
Keeping a ref on widgets is not enough to keep it alive, because gtk_widget_destroy will run destroy even if there are still refs. https://bugzilla.gnome.org/show_bug.cgi?id=680775
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-avatar-chooser.c13
1 files changed, 8 insertions, 5 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