diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2013-06-10 17:09:19 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2013-06-11 11:33:32 +0200 |
commit | 351ba3a165a5c8e74cca0f8160c399d9bb669e29 (patch) | |
tree | ea61c5ff108c0c20ed45df084a779719d2d22675 /src | |
parent | 6f3a33388a48a134142795540571f425ea165d26 (diff) |
EmpathyNewChatroomDialog: Make sure we use the TpRoomList that correspond to selected account
When switching account before tp_room_list_new_async() finish,
there is a race for which one will finish first. We ignore the
new TpRoomList if it does not correspond to the currently
selected account.
https://bugzilla.gnome.org/show_bug.cgi?id=698742
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-new-chatroom-dialog.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c index 5b9fa94c..3ce59ab8 100644 --- a/src/empathy-new-chatroom-dialog.c +++ b/src/empathy-new-chatroom-dialog.c @@ -496,16 +496,26 @@ new_room_list_cb (GObject *source, gpointer user_data) { EmpathyNewChatroomDialog *self = user_data; + TpRoomList *room_list; GError *error = NULL; - self->priv->room_list = tp_room_list_new_finish (result, &error); - if (self->priv->room_list == NULL) + room_list = tp_room_list_new_finish (result, &error); + if (room_list == NULL) { DEBUG ("Failed to create TpRoomList: %s\n", error->message); g_error_free (error); return; } + if (tp_room_list_get_account (room_list) != self->priv->account) + { + /* Account changed while we were creating this TpRoomList */ + g_object_unref (room_list); + return; + } + + self->priv->room_list = room_list; + tp_g_signal_connect_object (self->priv->room_list, "got-room", G_CALLBACK (new_chatroom_dialog_got_room_cb), self, 0); tp_g_signal_connect_object (self->priv->room_list, "failed", @@ -529,7 +539,6 @@ new_room_list_cb (GObject *source, gtk_widget_set_sensitive (self->priv->expander_browse, TRUE); new_chatroom_dialog_update_widgets (self); - } static void |