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
=== modified file 'nautilus/contacts-view.c'
--- nautilus/contacts-view.c 2010-03-25 18:09:05 +0000
+++ nautilus/contacts-view.c 2010-04-06 17:24:33 +0000
@@ -275,16 +275,32 @@
275275
276 for (l = contacts; l != NULL; l = l->next) {276 for (l = contacts; l != NULL; l = l->next) {
277 EContact *contact = l->data;277 EContact *contact = l->data;
278 const gchar *email;
279 GList *emails_list, *al;
278280
279 /* We add the selected items when searching, so ignore them here */281 /* We add the selected items when searching, so ignore them here */
280 if (g_hash_table_lookup (selection_hash, (gconstpointer) e_contact_get_const (contact, E_CONTACT_FULL_NAME)))282 if (g_hash_table_lookup (selection_hash, (gconstpointer) e_contact_get_const (contact, E_CONTACT_FULL_NAME)))
281 continue;283 continue;
282284
283 add_one_contact (cv,285 emails_list = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
284 e_contact_get_const (contact, E_CONTACT_FULL_NAME),286 for (al = emails_list; al != NULL; al = al->next) {
285 e_contact_get_const (contact, E_CONTACT_FULL_NAME),287 EVCardAttribute *attr = (EVCardAttribute *) al->data;
286 e_contact_get_const (contact, E_CONTACT_FIRST_EMAIL_ID),288
287 contact);289 email = e_vcard_attribute_get_value (attr);
290 if (email != NULL)
291 break;
292 }
293
294 if (email != NULL) {
295 add_one_contact (cv,
296 e_contact_get_const (contact, E_CONTACT_FULL_NAME),
297 e_contact_get_const (contact, E_CONTACT_FULL_NAME),
298 email,
299 contact);
300 }
301
302 g_list_foreach (emails_list, (GFunc) e_vcard_attribute_free, NULL);
303 g_list_free (emails_list);
288 }304 }
289305
290 g_signal_emit_by_name (cv, "contacts-count-changed",306 g_signal_emit_by_name (cv, "contacts-count-changed",

Subscribers

People subscribed via source and target branches