After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 645570 - Problems in _update_structured_name ()
Problems in _update_structured_name ()
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: libfolks
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on: 645569
Blocks:
 
 
Reported: 2011-03-22 21:36 UTC by Raul Gutierrez Segales
Modified: 2011-03-30 16:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix checks for empty and equal Structured Names (989 bytes, patch)
2011-03-22 21:36 UTC, Raul Gutierrez Segales
none Details | Review
Fix checks for empty and equal Structured Names (1.20 KB, patch)
2011-03-23 17:18 UTC, Raul Gutierrez Segales
none Details | Review
Fix checks for empty and equal Structured Names (1.56 KB, patch)
2011-03-26 00:49 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review

Description Raul Gutierrez Segales 2011-03-22 21:36:48 UTC
Created attachment 184129 [details] [review]
Fix checks for empty and equal Structured Names

There is 2 problems with _update_structured_name () in folks/individual.vala:

1) We check if a Persona has a different StructuredName than the one currently hold by the Individual by doing:

 if (new_value != this.structured_name)
   this.structured_name = new_value;

This comparison may be bogus because it rests upon Personas replacing entirely there structured_name property when updating it (its not the case for Tracker, since each member of StructuredName is updated in granular fashion so it makes no sense to create a new StructuredName each time we get a change).

What we could do instead is use the equal method in StructuredName proposed here:

https://bugzilla.gnome.org/show_bug.cgi?id=645569 

to correctly discriminate identical StructuredName(s).

2) _update_structured_name () assumes that persona.structured_name == NULL means an empty StructuredName. Again, for Tracker this is not the case. This should instead be checked with the is_empty method available in StructuredName.

Both problems are addressed by the attached patch.
Comment 1 Raul Gutierrez Segales 2011-03-23 17:18:36 UTC
Created attachment 184153 [details] [review]
Fix checks for empty and equal Structured Names

Updated to deal with this.structured_name not being initialized.
Comment 2 Philip Withnall 2011-03-25 22:32:20 UTC
You posted a more-updated version of the patch here yesterday in response to my comments about the property never getting unset again, but since Bugzilla went down it got lost. Could you re-attach it please?
Comment 3 Raul Gutierrez Segales 2011-03-26 00:45:51 UTC
(In reply to comment #2)
> You posted a more-updated version of the patch here yesterday in response to my
> comments about the property never getting unset again, but since Bugzilla went
> down it got lost. Could you re-attach it please?

Can you not see the currently attached patch to this report? That is the latest version of the patch.
Comment 4 Raul Gutierrez Segales 2011-03-26 00:49:06 UTC
Created attachment 184261 [details] [review]
Fix checks for empty and equal Structured Names

Actually - bugzilla did ate the last patch posted.
Comment 5 Philip Withnall 2011-03-29 23:10:52 UTC
Review of attachment 184261 [details] [review]:

Looks good. The same changes need making to _update_full_name(), _update_nickname(), _update_gender() and _update_im_addresses() (though this last one's slightly different).
Comment 6 Raul Gutierrez Segales 2011-03-30 15:05:14 UTC
Merged:

commit 45a0b1dd7b4384b2f11555c7dfb61dbfacb30de1
Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
Date:   Tue Mar 22 21:35:57 2011 +0000

    Fix checks for empty and equal StructuredNames

 NEWS                  |    1 +
 folks/individual.vala |   18 +++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)
Comment 7 Philip Withnall 2011-03-30 15:43:22 UTC
(In reply to comment #5)
> The same changes need making to _update_full_name(),
> _update_nickname(), _update_gender() and _update_im_addresses() (though this
> last one's slightly different).

What about this?
Comment 8 Raul Gutierrez Segales 2011-03-30 16:06:23 UTC
I am targeting those in a new bug report:

https://bugzilla.gnome.org/show_bug.cgi?id=646244