[telepathy-gabble/master] unregister pubsub event handlers when disposing
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Sep 25 02:29:51 PDT 2009
---
src/conn-aliasing.c | 4 ++--
src/conn-location.c | 4 ++--
src/conn-olpc.c | 12 ++++++++----
src/connection.c | 14 ++++++++++++++
src/connection.h | 6 ++++++
5 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/conn-aliasing.c b/src/conn-aliasing.c
index ebe223f..5e14c02 100644
--- a/src/conn-aliasing.c
+++ b/src/conn-aliasing.c
@@ -1040,8 +1040,8 @@ conn_aliasing_init (GabbleConnection *conn)
TP_IFACE_CONNECTION_INTERFACE_ALIASING,
conn_aliasing_fill_contact_attributes);
- wocky_pubsub_register_event_handler (conn->pubsub, NS_NICK,
- gabble_conn_aliasing_pep_nick_event_handler, conn);
+ conn->pubsub_alias_event_id = wocky_pubsub_register_event_handler (
+ conn->pubsub, NS_NICK, gabble_conn_aliasing_pep_nick_event_handler, conn);
}
void
diff --git a/src/conn-location.c b/src/conn-location.c
index 59ecfc2..05dee81 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -580,6 +580,6 @@ conn_location_init (GabbleConnection *conn)
TP_IFACE_CONNECTION_INTERFACE_LOCATION,
conn_location_fill_contact_attributes);
- wocky_pubsub_register_event_handler (conn->pubsub, NS_GEOLOC,
- geolocation_event_handler, conn);
+ conn->pubsub_location_event_id = wocky_pubsub_register_event_handler (
+ conn->pubsub, NS_GEOLOC, geolocation_event_handler, conn);
}
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index 7950b3a..d44ed94 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -3776,13 +3776,17 @@ conn_olpc_activity_properties_init (GabbleConnection *conn)
g_signal_connect (conn->olpc_gadget_manager, "new-channels",
G_CALLBACK (gadget_manager_new_channels_cb), conn);
- wocky_pubsub_register_event_handler (conn->pubsub, NS_OLPC_BUDDY_PROPS,
+ conn->pubsub_olpc_buddy_props_event_id = wocky_pubsub_register_event_handler (
+ conn->pubsub, NS_OLPC_BUDDY_PROPS,
olpc_buddy_info_properties_event_handler, conn);
- wocky_pubsub_register_event_handler (conn->pubsub, NS_OLPC_ACTIVITIES,
+ conn->pubsub_olpc_activities_event_id = wocky_pubsub_register_event_handler (
+ conn->pubsub, NS_OLPC_ACTIVITIES,
olpc_buddy_info_activities_event_handler, conn);
- wocky_pubsub_register_event_handler (conn->pubsub, NS_OLPC_CURRENT_ACTIVITY,
+ conn->pubsub_olpc_current_act_props_event_id =
+ wocky_pubsub_register_event_handler (conn->pubsub, NS_OLPC_CURRENT_ACTIVITY,
olpc_buddy_info_current_activity_event_handler, conn);
- wocky_pubsub_register_event_handler (conn->pubsub, NS_OLPC_ACTIVITY_PROPS,
+ conn->pubsub_olpc_act_props_props_event_id =
+ wocky_pubsub_register_event_handler (conn->pubsub, NS_OLPC_ACTIVITY_PROPS,
olpc_activities_properties_event_handler, conn);
}
diff --git a/src/connection.c b/src/connection.c
index d8a1e97..13efe77 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -990,6 +990,20 @@ gabble_connection_dispose (GObject *object)
priv->disconnect_timer = 0;
}
+ /* unregister pubsub event handlers */
+ wocky_pubsub_unregister_event_handler (self->pubsub,
+ self->pubsub_alias_event_id);
+ wocky_pubsub_unregister_event_handler (self->pubsub,
+ self->pubsub_location_event_id);
+ wocky_pubsub_unregister_event_handler (self->pubsub,
+ self->pubsub_olpc_buddy_props_event_id);
+ wocky_pubsub_unregister_event_handler (self->pubsub,
+ self->pubsub_olpc_activities_event_id);
+ wocky_pubsub_unregister_event_handler (self->pubsub,
+ self->pubsub_olpc_current_act_props_event_id);
+ wocky_pubsub_unregister_event_handler (self->pubsub,
+ self->pubsub_olpc_act_props_props_event_id);
+
if (self->pubsub != NULL)
{
g_object_unref (self->pubsub);
diff --git a/src/connection.h b/src/connection.h
index d842045..b9b5b6f 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -193,6 +193,12 @@ struct _GabbleConnection {
/* pubsub */
WockyPubsub *pubsub;
+ guint pubsub_alias_event_id;
+ guint pubsub_location_event_id;
+ guint pubsub_olpc_buddy_props_event_id;
+ guint pubsub_olpc_activities_event_id;
+ guint pubsub_olpc_current_act_props_event_id;
+ guint pubsub_olpc_act_props_props_event_id;
GabbleConnectionPrivate *priv;
};
--
1.5.6.5
More information about the telepathy-commits
mailing list