[folks] bluez: Fix removal of a Map element while iterating over the Map
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] bluez: Fix removal of a Map element while iterating over the Map
- Date: Sun, 16 Feb 2014 23:54:18 +0000 (UTC)
commit eb8b1ad75692316596ac8d96d8ee757139f530bf
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Nov 13 16:28:05 2013 +0000
bluez: Fix removal of a Map element while iterating over the Map
https://bugzilla.gnome.org/show_bug.cgi?id=712274
backends/bluez/bluez-backend.vala | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/backends/bluez/bluez-backend.vala b/backends/bluez/bluez-backend.vala
index 9032c43..e0dd38a 100644
--- a/backends/bluez/bluez-backend.vala
+++ b/backends/bluez/bluez-backend.vala
@@ -170,7 +170,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
if (!this._persona_stores.has_key (store.id))
return;
- this._remove_persona_store ((!) _store);
+ this._remove_persona_store ((!) _store, true, true);
}
/**
@@ -384,7 +384,8 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
this.notify_property ("persona-stores");
}
- private void _remove_persona_store (PersonaStore store)
+ private void _remove_persona_store (PersonaStore store,
+ bool remove_from_persona_stores, bool remove_from_watched_devices)
{
store.removed.disconnect (this._persona_store_removed_cb);
@@ -394,8 +395,10 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
this.persona_store_removed (store);
- this._persona_stores.unset (store.id);
- this._watched_devices.unset (store.object_path);
+ if (remove_from_persona_stores == true)
+ this._persona_stores.unset (store.id);
+ if (remove_from_watched_devices == true)
+ this._watched_devices.unset (store.object_path);
this.notify_property ("persona-stores");
}
@@ -514,7 +517,7 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
if (this._watched_devices.unset (path, out store) == true)
{
debug ("Device ā%sā removed", path);
- this._remove_persona_store (store);
+ this._remove_persona_store (store, true, false);
}
}
@@ -679,11 +682,13 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
this.freeze_notify ();
- foreach (var persona_store in this._persona_stores.values)
- this._remove_persona_store (persona_store);
+ var iter = this._persona_stores.map_iterator ();
+ while (iter.next () == true)
+ {
+ this._remove_persona_store (iter.get_value (), false, true);
+ iter.unset ();
+ }
- this._watched_devices.clear ();
- this._persona_stores.clear ();
this.notify_property ("persona-stores");
this._is_quiescent = false;
@@ -702,6 +707,6 @@ public class Folks.Backends.BlueZ.Backend : Folks.Backend
private void _persona_store_removed_cb (Folks.PersonaStore store)
{
- this._remove_persona_store ((BlueZ.PersonaStore) store);
+ this._remove_persona_store ((BlueZ.PersonaStore) store, true, true);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]