=?utf-8?q?=5Bfolks=5D_core=3A_Don=E2=80=99t_modify_a_HashSet_while_iterat?= =?utf-8?q?ing_over_it?=
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Donât modify a HashSet while iterating over it
- Date: Mon, 19 Mar 2012 13:50:04 +0000 (UTC)
commit 46d4506d346199f53039d8d31275b8ce61146528
Author: Philip Withnall <philip tecnocode co uk>
Date: Mon Mar 5 00:11:09 2012 +0000
core: Donât modify a HashSet while iterating over it
Even though we were modifying it from the Iterator (which shouldâve been OK),
we got hit by https://bugzilla.gnome.org/show_bug.cgi?id=671327 which meant
that some Personas weren't getting disconnected from Individuals. This is a
likely cause of bug #670523.
This also includes a related (but irrelevant to the bug itself) tidy-up to
Persona._individual.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=670523
NEWS | 2 ++
folks/individual.vala | 11 ++++++-----
folks/persona.vala | 4 ++--
3 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index f4607a8..a09046d 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ Overview of changes from libfolks 0.6.7 to libfolks 0.6.8
=============================================================
Bugs fixed:
* Bug 670191 â IndividualAggregator::is-quiescent is never set to TRUE
+* Bug 670523 â persona.vala:153:folks_persona_get_individual:
+ assertion failed: (_tmp6_)
Overview of changes from libfolks 0.6.6 to libfolks 0.6.7
=============================================================
diff --git a/folks/individual.vala b/folks/individual.vala
index 7321bc5..2a0f6cd 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -1940,11 +1940,8 @@ public class Folks.Individual : Object,
}
/* Determine which Personas have been removed */
- var iter = this._persona_set.iterator ();
- while (iter.next ())
+ foreach (var p in this._persona_set)
{
- var p = iter.get ();
-
if (personas == null || !((!) personas).contains (p))
{
/* Keep track of how many Personas are users */
@@ -1970,10 +1967,14 @@ public class Folks.Individual : Object,
}
this._disconnect_from_persona (p, replacement_individual);
- iter.remove ();
}
}
+ foreach (var p in removed)
+ {
+ this._persona_set.remove (p);
+ }
+
this._emit_personas_changed (added, removed);
/* Update this.is_user */
diff --git a/folks/persona.vala b/folks/persona.vala
index 3f7735f..41e9ce8 100644
--- a/folks/persona.vala
+++ b/folks/persona.vala
@@ -61,8 +61,6 @@ public errordomain Folks.PropertyError
*/
public abstract class Folks.Persona : Object
{
- private weak Individual? _individual;
-
/**
* The internal ID used to represent the Persona for linking.
*
@@ -137,6 +135,8 @@ public abstract class Folks.Persona : Object
*/
public weak PersonaStore store { get; construct; }
+ private weak Individual? _individual = null;
+
private void _individual_weak_notify_cb (Object obj)
{
debug ("Individual %p has been destroyed; resetting the Individual of %s",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]