Changeset 1a8875f


Ignore:
Timestamp:
2016-09-25T03:07:25Z (4 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
ff468a7
Parents:
985d66d
Message:

purple: Fix another issue where /join results in two channels

Follow up to a3019499665384a3dcbbc11016d256e6d4dcd26c (which actually
made things worse than before for this particular case - found it by
bisecting)

This affected skypeweb and hangouts, maybe others.

Sometimes serv_join_chat() results in a call chain like this
(outermost frame first)

  1. purple_chat_join
  2. serv_join_chat
  3. (the join_chat function of the prpl)
  4. serv_got_joined_chat
  5. purple_conversation_new
  6. prplcb_conv_new

The last one tries to find a struct groupchat by name (that's the code
from the referenced commit). If it doesn't exist, it creates a new one.
This usually isn't an issue because the 4th step is done asynchronously,
and a groupchat is created at the end of purple_chat_join. If it's not,
you end up with two groupchats, which can lead to other nasty issues.

This moves the creation of the groupchat right before serv_join_chat().
That way, it always exists even if the conversation is created
immediately.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r985d66d r1a8875f  
    723723        GHashTable *chat_hash;
    724724        PurpleConversation *conv;
     725        struct groupchat *gc;
    725726        GList *info, *l;
    726727
     
    756757        g_list_free(info);
    757758
     759        /* do this before serv_join_chat to handle cases where prplcb_conv_new is called immediately (not async) */
     760        gc = imcb_chat_new(ic, room);
     761
    758762        serv_join_chat(purple_account_get_connection(pd->account), chat_hash);
    759763
    760764        g_hash_table_destroy(chat_hash);
    761765
    762         return imcb_chat_new(ic, room);
     766        return gc;
    763767}
    764768
Note: See TracChangeset for help on using the changeset viewer.