[folks/folks-0-4] Tidy up channel signal disconnections in Tpf.PersonaStore
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks/folks-0-4] Tidy up channel signal disconnections in Tpf.PersonaStore
- Date: Tue, 26 Apr 2011 21:01:46 +0000 (UTC)
commit b5fe56165043526d63c939c2b123b1ebc276400c
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Apr 22 22:36:13 2011 +0100
Tidy up channel signal disconnections in Tpf.PersonaStore
Helps: bgo#645186
backends/telepathy/lib/tpf-persona-store.vala | 53 ++++++++++++++++++++++--
1 files changed, 48 insertions(+), 5 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index c174b44..6987349 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -203,7 +203,14 @@ public class Tpf.PersonaStore : Folks.PersonaStore
this._personas = new HashTable<string, Persona> (str_hash,
str_equal);
- this._conn = null;
+
+ if (this._conn != null)
+ {
+ this._conn.notify["self-handle"].disconnect (
+ this._self_handle_changed_cb);
+ this._conn = null;
+ }
+
this._handle_persona_map = new HashMap<uint, Persona> ();
this._channel_group_personas_map =
new HashMap<Channel, HashSet<Persona>> ();
@@ -215,19 +222,19 @@ public class Tpf.PersonaStore : Folks.PersonaStore
if (this._publish != null)
{
- this._publish.invalidated.disconnect (this._channel_invalidated_cb);
+ this._disconnect_from_standard_channel (this._publish);
this._publish = null;
}
if (this._stored != null)
{
- this._stored.invalidated.disconnect (this._channel_invalidated_cb);
+ this._disconnect_from_standard_channel (this._stored);
this._stored = null;
}
if (this._subscribe != null)
{
- this._subscribe.invalidated.disconnect (this._channel_invalidated_cb);
+ this._disconnect_from_standard_channel (this._subscribe);
this._subscribe = null;
}
@@ -239,7 +246,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
foreach (var channel in this._groups.values)
{
if (channel != null)
- channel.invalidated.disconnect (this._channel_invalidated_cb);
+ this._disconnect_from_group_channel (channel);
}
}
@@ -768,6 +775,32 @@ public class Tpf.PersonaStore : Folks.PersonaStore
});
}
+ private void _disconnect_from_standard_channel (Channel channel)
+ {
+ var name = channel.get_identifier ();
+ debug ("Disconnecting from channel '%s'.", name);
+
+ channel.invalidated.disconnect (this._channel_invalidated_cb);
+
+ if (name == "publish")
+ {
+ channel.group_members_changed_detailed.disconnect (
+ this._publish_channel_group_members_changed_detailed_cb);
+ }
+ else if (name == "stored")
+ {
+ channel.group_members_changed_detailed.disconnect (
+ this._stored_channel_group_members_changed_detailed_cb);
+ }
+ else if (name == "subscribe")
+ {
+ channel.group_members_changed_detailed.disconnect (
+ this._subscribe_channel_group_members_changed_detailed_cb);
+ channel.group_flags_changed.disconnect (
+ this._subscribe_channel_group_flags_changed_cb);
+ }
+ }
+
private void _publish_channel_group_members_changed_detailed_cb (
Channel channel,
/* FIXME: Array<uint> => Array<Handle>; parser bug */
@@ -1142,6 +1175,16 @@ public class Tpf.PersonaStore : Folks.PersonaStore
});
}
+ private void _disconnect_from_group_channel (Channel channel)
+ {
+ var name = channel.get_identifier ();
+ debug ("Disconnecting from group channel '%s'.", name);
+
+ channel.group_members_changed_detailed.disconnect (
+ this._channel_group_members_changed_detailed_cb);
+ channel.invalidated.disconnect (this._channel_invalidated_cb);
+ }
+
private void _channel_group_members_changed_detailed_cb (Channel channel,
/* FIXME: Array<uint> => Array<Handle>; parser bug */
Array<uint> added,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]