aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-02-01 18:34:37 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-02-01 18:34:37 +0800
commit9503c4aa28b9a4215e3e325a31b500f2c78b712a (patch)
tree7504827760a11aa72d7dd91cbdba0c68b8936934 /libempathy-gtk
parent21321727a45ac859405638ba034dc4212f1374b8 (diff)
downloadgsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.tar
gsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.tar.gz
gsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.tar.bz2
gsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.tar.lz
gsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.tar.xz
gsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.tar.zst
gsoc2013-empathy-9503c4aa28b9a4215e3e325a31b500f2c78b712a.zip
individual-widget: connect on the notify::client-types only once
Reconnecting a signal while you are handling it isn't exactly a good idea as it will result in an infinite loop eating all your memory (#635105).
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-widget.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c
index 2f7899b2b..6cb6226a5 100644
--- a/libempathy-gtk/empathy-individual-widget.c
+++ b/libempathy-gtk/empathy-individual-widget.c
@@ -200,6 +200,14 @@ contact_info_field_cmp (TpContactInfoField *field1,
}
static void
+client_types_notify_cb (TpContact *contact,
+ GParamSpec *pspec,
+ EmpathyIndividualWidget *self)
+{
+ client_types_update (self);
+}
+
+static void
update_weak_contact (EmpathyIndividualWidget *self)
{
EmpathyIndividualWidgetPriv *priv = GET_PRIV (self);
@@ -244,6 +252,9 @@ update_weak_contact (EmpathyIndividualWidget *self)
priv->contact = tp_contact;
g_object_add_weak_pointer (G_OBJECT (tp_contact),
(gpointer *) &priv->contact);
+
+ g_signal_connect (priv->contact, "notify::client-types",
+ (GCallback) client_types_notify_cb, self);
}
}
@@ -810,14 +821,6 @@ location_update (EmpathyIndividualWidget *self)
}
static void
-client_types_notify_cb (TpContact *contact,
- GParamSpec *pspec,
- EmpathyIndividualWidget *self)
-{
- client_types_update (self);
-}
-
-static void
client_types_update (EmpathyIndividualWidget *self)
{
EmpathyIndividualWidgetPriv *priv = GET_PRIV (self);
@@ -850,8 +853,6 @@ client_types_update (EmpathyIndividualWidget *self)
gtk_widget_hide (priv->hbox_client_types);
}
- g_signal_connect (priv->contact, "notify::client-types",
- (GCallback) client_types_notify_cb, self);
}
static void
@@ -862,6 +863,9 @@ remove_weak_contact (EmpathyIndividualWidget *self)
if (priv->contact == NULL)
return;
+ g_signal_handlers_disconnect_by_func (priv->contact, client_types_notify_cb,
+ self);
+
g_object_remove_weak_pointer (G_OBJECT (priv->contact),
(gpointer *) &priv->contact);
priv->contact = NULL;