aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-individual-manager.c
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-09-01 21:59:03 +0800
committerPhilip Withnall <philip.withnall@collabora.co.uk>2010-09-02 22:01:30 +0800
commita4a6f1b83dcf33c57c0fca1a7f68735df05f888e (patch)
tree181c579a4881818d4c6ff0096c4cbb9000b6802d /libempathy/empathy-individual-manager.c
parent88a455a446bdf3617de594052dc5c756c1013da8 (diff)
downloadgsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.tar
gsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.tar.gz
gsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.tar.bz2
gsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.tar.lz
gsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.tar.xz
gsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.tar.zst
gsoc2013-empathy-a4a6f1b83dcf33c57c0fca1a7f68735df05f888e.zip
Don't unnecessarily remove Individuals if Individual IDs have been reused
When linking and unlinking, it's possible for the linked Individual to have the same ID as one of its component Individuals (before linked or once unlinked). If two such Individuals with the same ID are added and removed at the same time (as could [only] happen during linking or unlinking), EmpathyIndividualManager should do the Individual removals before the additions, in order to prevent one of the Individuals getting clobbered. Closes: bgo#627819
Diffstat (limited to 'libempathy/empathy-individual-manager.c')
-rw-r--r--libempathy/empathy-individual-manager.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index 1e76cbf83..15baa8538 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -173,6 +173,20 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
EmpathyIndividualManagerPriv *priv = GET_PRIV (self);
GList *l, *added_filtered = NULL;
+ /* Handle the removals first, as one of the added Individuals might have the
+ * same ID as one of the removed Individuals (due to linking). */
+ for (l = removed; l; l = l->next)
+ {
+ FolksIndividual *ind = FOLKS_INDIVIDUAL (l->data);
+
+ g_signal_handlers_disconnect_by_func (ind,
+ individual_notify_personas_cb, self);
+
+ if (g_hash_table_lookup (priv->individuals,
+ folks_individual_get_id (ind)) != NULL)
+ remove_individual (self, ind);
+ }
+
/* Filter the individuals for ones which contain EmpathyContacts */
for (l = added; l; l = l->next)
{
@@ -188,18 +202,6 @@ aggregator_individuals_changed_cb (FolksIndividualAggregator *aggregator,
}
}
- for (l = removed; l; l = l->next)
- {
- FolksIndividual *ind = FOLKS_INDIVIDUAL (l->data);
-
- g_signal_handlers_disconnect_by_func (ind,
- individual_notify_personas_cb, self);
-
- if (g_hash_table_lookup (priv->individuals,
- folks_individual_get_id (ind)) != NULL)
- remove_individual (self, ind);
- }
-
/* Bail if we have no individuals left */
if (added_filtered == NULL && removed == NULL)
return;