Merge lp:~rodrigo-moya/ubuntuone-client/share-my-picked-contacts into lp:ubuntuone-client

Proposed by Rodrigo Moya
Status: Merged
Approved by: Tim Cole
Approved revision: 475
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/ubuntuone-client/share-my-picked-contacts
Merge into: lp:ubuntuone-client
Diff against target: 41 lines (+21/-5)
1 file modified
nautilus/contacts-view.c (+21/-5)
To merge this branch: bzr merge lp:~rodrigo-moya/ubuntuone-client/share-my-picked-contacts
Reviewer Review Type Date Requested Status
Tim Cole (community) Approve
Joshua Hoover (community) ran branch and verified bug fix Approve
Review via email: mp+22873@code.launchpad.net

Commit message

Make sure we have an email address for contacts we show

Description of the change

Make sure we have an email address for contacts we show

To post a comment you must log in.
Revision history for this message
Joshua Hoover (joshuahoover) wrote :

Tested Rodrigo's branch following the steps I outlined in the bug report and was successful.

review: Approve (ran branch and verified bug fix)
Revision history for this message
Tim Cole (tcole) wrote :

This has a memory leak: the list returned by e_contact_get_attributes needs to be freed by the caller. (The individual attribute objects don't -- they're still owned by the contact object.)

review: Needs Fixing
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

> This has a memory leak: the list returned by e_contact_get_attributes needs to
> be freed by the caller. (The individual attribute objects don't -- they're
> still owned by the contact object.)

right, fixed. But the individual attribute objects are also owned by the caller, so added code to free them both

475. By Rodrigo Moya

Fixed memory leak

Revision history for this message
Tim Cole (tcole) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nautilus/contacts-view.c'
2--- nautilus/contacts-view.c 2010-03-25 18:09:05 +0000
3+++ nautilus/contacts-view.c 2010-04-06 17:24:33 +0000
4@@ -275,16 +275,32 @@
5
6 for (l = contacts; l != NULL; l = l->next) {
7 EContact *contact = l->data;
8+ const gchar *email;
9+ GList *emails_list, *al;
10
11 /* We add the selected items when searching, so ignore them here */
12 if (g_hash_table_lookup (selection_hash, (gconstpointer) e_contact_get_const (contact, E_CONTACT_FULL_NAME)))
13 continue;
14
15- add_one_contact (cv,
16- e_contact_get_const (contact, E_CONTACT_FULL_NAME),
17- e_contact_get_const (contact, E_CONTACT_FULL_NAME),
18- e_contact_get_const (contact, E_CONTACT_FIRST_EMAIL_ID),
19- contact);
20+ emails_list = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
21+ for (al = emails_list; al != NULL; al = al->next) {
22+ EVCardAttribute *attr = (EVCardAttribute *) al->data;
23+
24+ email = e_vcard_attribute_get_value (attr);
25+ if (email != NULL)
26+ break;
27+ }
28+
29+ if (email != NULL) {
30+ add_one_contact (cv,
31+ e_contact_get_const (contact, E_CONTACT_FULL_NAME),
32+ e_contact_get_const (contact, E_CONTACT_FULL_NAME),
33+ email,
34+ contact);
35+ }
36+
37+ g_list_foreach (emails_list, (GFunc) e_vcard_attribute_free, NULL);
38+ g_list_free (emails_list);
39 }
40
41 g_signal_emit_by_name (cv, "contacts-count-changed",

Subscribers

People subscribed via source and target branches