[folks] aggregator: Ensure we don't remove Personas we're adding



commit 67cf88527d96fcc345c18d5c3bf974f7fb11ae48
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jul 25 22:58:15 2011 +0100

    aggregator: Ensure we don't remove Personas we're adding
    
    If a two Personas with the same UID are in the added and removed sets for a
    single call to personas_changed_cb() in the individual aggregator, make sure
    that we remove the old instance and replace it with the new instance, instead
    of just removing both instances. This covers the case where the real instance
    of a (Tpf.) Persona disappears and is immediately replaced by its cached
    copy.
    
    NOTE: This needs more testing.

 folks/individual-aggregator.vala |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/folks/individual-aggregator.vala b/folks/individual-aggregator.vala
index 779b11b..3b7bc86 100644
--- a/folks/individual-aggregator.vala
+++ b/folks/individual-aggregator.vala
@@ -789,12 +789,6 @@ public class Folks.IndividualAggregator : Object
        * property. */
       var user = this.user;
 
-      if (added.size > 0)
-        {
-          this._add_personas (added, ref added_individuals,
-              ref replaced_individuals, ref user);
-        }
-
       debug ("Removing Personas:");
 
       foreach (var persona in removed)
@@ -854,6 +848,19 @@ public class Folks.IndividualAggregator : Object
           individual.personas = null;
         }
 
+      debug ("Adding Personas:");
+      foreach (var persona in added)
+        {
+          debug ("    %s (is user: %s, IID: %s)", persona.uid,
+              persona.is_user ? "yes" : "no", persona.iid);
+        }
+
+      if (added.size > 0)
+        {
+          this._add_personas (added, ref added_individuals,
+              ref replaced_individuals, ref user);
+        }
+
       debug ("Relinking Personas:");
       foreach (var persona in relinked_personas)
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]