[folks/folks-0-4] Copy new Emails for individuals, don't hold stale pointers.
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks/folks-0-4] Copy new Emails for individuals, don't hold stale pointers.
- Date: Fri, 18 Mar 2011 20:32:33 +0000 (UTC)
commit 433e336c8ac6c5924aa64763f924cfe0c9b64d20
Author: Raul Gutierrez Segales <raul gutierrez segales collabora co uk>
Date: Wed Mar 16 21:51:57 2011 +0000
Copy new Emails for individuals, don't hold stale pointers.
Fixed bgo#644966 - _update_emails () needs to create copies of each
List<FieldDetails>
NEWS | 4 ++++
folks/individual.vala | 13 +++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 37cc649..51e7c5b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
Overview of changes from libfolks 0.4.0 to libfolks 0.4.1
=========================================================
+Bugs fixed:
+* Bug 644966 - _update_emails () needs to create copies of each
+ List<FieldDetails>
+
Overview of changes from libfolks 0.3.6 to libfolks 0.4.0
=========================================================
diff --git a/folks/individual.vala b/folks/individual.vala
index a3a1b86..a81036f 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -1133,6 +1133,8 @@ public class Folks.Individual : Object,
* If the same URL exist multiple times we merge the parameters. */
var emails_set = new HashTable<unowned string, unowned FieldDetails> (
str_hash, str_equal);
+ var emails = new GLib.List<FieldDetails> ();
+
foreach (var persona in this._persona_list)
{
var email_details = persona as EmailDetails;
@@ -1147,11 +1149,18 @@ public class Folks.Individual : Object,
if (existing != null)
existing.extend_parameters (fd.parameters);
else
- emails_set.insert (fd.value, fd);
+ {
+ var new_fd = new FieldDetails (fd.value);
+ new_fd.extend_parameters (fd.parameters);
+ emails_set.insert (fd.value, new_fd);
+ emails.prepend ((owned) new_fd);
+ }
}
}
}
- this._email_addresses = emails_set.get_values ();
+ /* Set the private member directly to avoid iterating this list again */
+ emails.reverse ();
+ this._email_addresses = (owned) emails;
this.notify_property ("email-addresses");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]