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 662770 - ContactPhotos are ignored when mime type is null
ContactPhotos are ignored when mime type is null
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: e-d-s backend
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2011-10-26 14:25 UTC by Raul Gutierrez Segales
Modified: 2011-10-27 00:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.43 KB, patch)
2011-10-26 14:30 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review

Description Raul Gutierrez Segales 2011-10-26 14:25:48 UTC
In backends/eds/lib/edsf-persona.vala#_contact_photo_to_loadable_icon we are returning null when the mime type is not available (i.e.: null) but it turns out this is perfectly valid for an EContact.

Also, Edsf.MemoryIcon has an inconsistent approach towards the image_type. In some parts of the class definition documentation says that it (the image type) can be null whereas in other parts (the constructor and the instance member declaration) it is not stated (i.e.: we don't use string?).
Comment 1 Raul Gutierrez Segales 2011-10-26 14:30:52 UTC
Created attachment 200024 [details] [review]
patch

The most controversial point in this patch is what to do in hash() when image_type is null. I went with starting (uint) hash to 0. I wonder how happy will Philip be about this :)
Comment 2 Raul Gutierrez Segales 2011-10-26 14:32:28 UTC
Note that fixing https://bugzilla.gnome.org/show_bug.cgi?id=662616 will greatly reduce the possibility of hitting this bug.
Comment 3 Travis Reitter 2011-10-26 16:43:45 UTC
Review of attachment 200024 [details] [review]:

Honestly, I don't see any problem with using 0 as the hash value for null image_types. The content should be the part that matters, right?

(Philip, please inform me if I'm missing something)

This patch looks fine to me - maybe double-check with Philip.
Comment 4 Philip Withnall 2011-10-26 20:16:46 UTC
Review of attachment 200024 [details] [review]:

I can't think of a problem with using 0. I was going to suggest using 5381, which is the base value used in g_str_hash() — but then I realised that would make the hashes of a MemoryIcon with a null image type and a MemoryIcon with an empty string image type equal, which probably isn't desirable. 0 is good.
Comment 5 Philip Withnall 2011-10-26 20:17:40 UTC
Review of attachment 200024 [details] [review]:

Don't forget to modify NEWS, though.
Comment 6 Raul Gutierrez Segales 2011-10-27 00:06:55 UTC
Thanks for the reviews. Merged:

commit aa50fcfa896f9102411f1f5b6772e17129f1decc
Author: Raul Gutierrez Segales <rgs@collabora.co.uk>
Date:   Wed Oct 26 15:26:07 2011 +0100

    e-d-s: load icon regardless of the mime type being available
    
    Also, allow Edsf.MemoryIcon to be instantiated with a null
    image type. The notion of the image type not being available
    was half there (some comments mentioned the possibility), but
    it wasn't contemplated in the constructor and in the instance
    variable.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=662770