[folks] eds: Fix incorrect removal of elements of a read-only libgee collection



commit a92acd8a9ff837df5636fa9f7e9cf09d6c2d3e15
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Feb 16 22:50:56 2014 +0000

    eds: Fix incorrect removal of elements of a read-only libgee collection
    
    The .remove() calls would hit an assert_not_reached() in libgee. Remove
    from the MapIterator instead.

 backends/eds/eds-backend.vala |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/backends/eds/eds-backend.vala b/backends/eds/eds-backend.vala
index 90855f2..7bdb1a5 100644
--- a/backends/eds/eds-backend.vala
+++ b/backends/eds/eds-backend.vala
@@ -133,11 +133,11 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
             }
         }
 
-      var iter = this._persona_stores.values.iterator ();
+      var iter = this._persona_stores.map_iterator ();
 
       while (iter.next ())
         {
-          var store = iter.get ();
+          var store = iter.get_value ();
 
           if (!storeids.contains (store.id))
             {
@@ -249,10 +249,10 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
           this._prepare_pending = true;
           this.freeze_notify ();
 
-          var iter = this._persona_stores.values.iterator ();
+          var iter = this._persona_stores.map_iterator ();
 
           while (iter.next ())
-            this._remove_address_book (iter.get (), true, iter);
+            this._remove_address_book (iter.get_value (), true, iter);
 
           this._ab_sources.source_added.disconnect (this._ab_source_list_changed_cb);
           this._ab_sources.source_enabled.disconnect (this._ab_source_list_changed_cb);
@@ -345,14 +345,14 @@ public class Folks.Backends.Eds.Backend : Folks.Backend
 
   private void _remove_address_book (Folks.PersonaStore store,
       bool notify = true,
-      Iterator<Folks.PersonaStore>? iter = null)
+      MapIterator<string, Folks.PersonaStore>? iter = null)
     {
       debug ("Removing address book '%s'.", store.id);
 
       if (iter != null)
         {
-          assert (store == iter.get ());
-          iter.remove ();
+          assert (store == iter.get_value ());
+          iter.unset ();
         }
       else
         {


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