summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>2011-03-16 21:51:57 (GMT)
committerRaul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>2011-03-17 00:47:50 (GMT)
commit260e6f2a90a8c509b5dbaa673029a621601c78fb (patch)
tree53258ce4b43173f6e09a59f3f1ccef2405b6f5cb
parentb2f1610eae99a0799d97a45132c1d51bd1312bf5 (diff)
downloadfolks-260e6f2a90a8c509b5dbaa673029a621601c78fb.tar.gz
folks-260e6f2a90a8c509b5dbaa673029a621601c78fb.tar.xz
Copy new Emails for individuals, don't hold stale pointers.
Fixed bgo#644966 - _update_emails () needs to create copies of each List<FieldDetails>
-rw-r--r--NEWS4
-rw-r--r--folks/individual.vala13
2 files changed, 15 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index ace73ca..432244f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,10 @@
Overview of changes from libfolks 0.4.0 to libfolks 0.5.0
=========================================================
+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");
}