[empathy] individual-widget: connect on the notify::client-types only once
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] individual-widget: connect on the notify::client-types only once
- Date: Tue, 1 Feb 2011 14:07:01 +0000 (UTC)
commit 9503c4aa28b9a4215e3e325a31b500f2c78b712a
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Feb 1 11:34:37 2011 +0100
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).
libempathy-gtk/empathy-individual-widget.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c
index 2f7899b..6cb6226 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]