[folks/648811-dummy-backend-rebase1] fixup! Only remove the persona from the personas list after the loop, to avoid problems with the ite



commit a24525c79eafd2eece703bc6b82b7a2348245da9
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Nov 7 12:28:00 2013 +0000

    fixup! Only remove the persona from the personas list after the loop, to avoid problems with the iterator.

 backends/dummy/lib/dummy-persona-store.vala |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/backends/dummy/lib/dummy-persona-store.vala b/backends/dummy/lib/dummy-persona-store.vala
index 61f6abe..2d97cbf 100644
--- a/backends/dummy/lib/dummy-persona-store.vala
+++ b/backends/dummy/lib/dummy-persona-store.vala
@@ -1080,16 +1080,15 @@ public class FolksDummy.PersonaStore : Folks.PersonaStore
           removed_personas.add ((!) persona);
         }
 
-      if (emit_notifications == true)
-        {
-           foreach(var _persona in removed_personas)
-             {
-                this._personas.unset (((!) _persona).iid);
-             }
-         }
-       
+      /* Modify this._personas afterwards, just in case
+       * personas == this._personas. */
        if (removed_personas.size > 0 && emit_notifications == true)
+         {
+           foreach (var _persona in removed_personas)
+                this._personas.unset (_persona.iid);
+
            this._emit_personas_changed (null, removed_personas);
+         }
     }
 
   /**


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