Commit c7572e44 authored by Niels De Graef's avatar Niels De Graef
Browse files

edsf: Don't make copies of E.VCardAttribute

Using `var` in Vala automatically means you take a strong reference,
which in the case of boxed types means that we will copy them (even if
not necessary). We probably want to avoid this inside `Edsf.Persona`,
since that means we might do multiple copies on each contact of a user.
parent baa456be
Pipeline #186305 failed with stages
in 26 minutes and 30 seconds
......@@ -1747,7 +1747,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
E.VCardAttribute new_attr = new E.VCardAttribute (null, name);
new_attr.add_value (details.value);
vcard.add_attribute (new_attr);
vcard.add_attribute ((owned) new_attr);
yield this._commit_modified_property (persona, null);
}
......@@ -2241,7 +2241,7 @@ public class Edsf.PersonaStore : Folks.PersonaStore
new_attr.add_value (group);
}
vcard.add_attribute (new_attr);
vcard.add_attribute ((owned) new_attr);
}
internal async void _set_gender (Edsf.Persona persona,
......
......@@ -1178,7 +1178,7 @@ public class Edsf.Persona : Folks.Persona,
private void _update_gender ()
{
var gender = Gender.UNSPECIFIED;
var gender_attr =
unowned E.VCardAttribute gender_attr =
this.contact.get_attribute (Edsf.Persona.gender_attribute_name);
if (gender_attr != null)
......@@ -1391,7 +1391,8 @@ public class Edsf.Persona : Folks.Persona,
null, null, AbstractFieldDetails<string>.hash_static,
AbstractFieldDetails<string>.equal_static);
var services = this.contact.get_attribute ("X-FOLKS-WEB-SERVICES-IDS");
unowned E.VCardAttribute services =
this.contact.get_attribute ("X-FOLKS-WEB-SERVICES-IDS");
if (services != null)
{
foreach (var service in ((!) services).get_params ())
......@@ -1425,7 +1426,7 @@ public class Edsf.Persona : Folks.Persona,
AbstractFieldDetails<string>.equal_static);
var attrs = this.contact.get_attributes (E.ContactField.EMAIL);
foreach (var attr in attrs)
foreach (unowned E.VCardAttribute attr in attrs)
{
var val = attr.get_value ();
if (val == null || (!) val == "")
......@@ -1699,7 +1700,7 @@ public class Edsf.Persona : Folks.Persona,
{
var addresses = this.contact.get_attributes (
im_eds_map.lookup (im_proto));
foreach (var attr in addresses)
foreach (unowned E.VCardAttribute attr in addresses)
{
try
{
......@@ -2013,7 +2014,7 @@ public class Edsf.Persona : Folks.Persona,
AbstractFieldDetails<string>.equal_static);
var attrs = this.contact.get_attributes (E.ContactField.TEL);
foreach (var attr in attrs)
foreach (unowned E.VCardAttribute attr in attrs)
{
var val = attr.get_value ();
if (val == null || (!) val == "")
......@@ -2155,7 +2156,8 @@ public class Edsf.Persona : Folks.Persona,
{
var new_local_ids = new SmallSet<string> ();
var ids = this.contact.get_attribute ("X-FOLKS-CONTACTS-IDS");
unowned E.VCardAttribute ids =
this.contact.get_attribute ("X-FOLKS-CONTACTS-IDS");
if (ids != null)
{
unowned GLib.List<string> ids_v = ((!) ids).get_values ();
......@@ -2219,7 +2221,8 @@ public class Edsf.Persona : Folks.Persona,
{
bool is_fav = false;
var fav = this.contact.get_attribute ("X-FOLKS-FAVOURITE");
unowned E.VCardAttribute fav =
this.contact.get_attribute ("X-FOLKS-FAVOURITE");
if (fav != null)
{
var val = ((!) fav).get_value ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment