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 684971 - empathy-chat: loses multi personas in the the contact menu
empathy-chat: loses multi personas in the the contact menu
Status: RESOLVED FIXED
Product: empathy
Classification: Core
Component: General
2.33.x
Other Linux
: Normal normal
: ---
Assigned To: empathy-maint
empathy-maint
Depends on:
Blocks:
 
 
Reported: 2012-09-27 15:22 UTC by Guillaume Desmottes
Modified: 2012-09-28 11:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
individual_menu_add_personas(): restore the persona.individual after creating single_individual (1.23 KB, patch)
2012-09-28 10:06 UTC, Guillaume Desmottes
committed Details | Review

Description Guillaume Desmottes 2012-09-27 15:22:28 UTC
- Open a chat with an individual having at least 2 persona. Open the 'Contact' menu: all the personas are listed
- Open a chat with another individual
- Go back to the first individual and re-open the 'Contact' menu: the personas are now listed any more.
Comment 1 Guillaume Desmottes 2012-09-28 10:01:03 UTC
Here is what's happening:

The first time the menu is created, individual_menu_add_personas(IndivididualA) is called and does:
   foreach (persona from individual):
     single_individual = empathy_create_individual_from_tp_contact (persona.tp_contact)

This is used to create a new 'contact sub menu' per persona.
By doing this persona.individual changes from IndividualA to single_individual.

Then when we switch to another individual, the menu is destroyed and single_individual is destroyed (it was just a transient individual created for the sole purpose of the menu). As this individual is destroyed, Folks's weak ref reset persona.individual to NULL.

So when we switch back to individualA again, the persona -> individual link is lost and so everything is confused.
Comment 2 Guillaume Desmottes 2012-09-28 10:06:15 UTC
Created attachment 225325 [details] [review]
individual_menu_add_personas(): restore the persona.individual after creating single_individual
Comment 3 Guillaume Desmottes 2012-09-28 10:07:37 UTC
This patch is pretty hacky but does the job and fixes the bug. I'm open to better suggestion.
Comment 4 Philip Withnall 2012-09-28 11:22:59 UTC
(In reply to comment #3)
> This patch is pretty hacky but does the job and fixes the bug. I'm open to
> better suggestion.

This is no more hacky than the empathy_create_individual_from_tp_contact() call is. So it’s quite hacky.

It’s probably the best solution short of getting rewriting the whole lot to get rid of empathy_create_individual_from_tp_contact().
Comment 5 Guillaume Desmottes 2012-09-28 11:25:01 UTC
Thanks, that will do as a fix fo 3.6 then. :)
Comment 6 Guillaume Desmottes 2012-09-28 11:25:35 UTC
Attachment 225325 [details] pushed as 3657e26 - individual_menu_add_personas(): restore the persona.individual after creating single_individual