]> git.0d.be Git - empathy.git/commitdiff
EmpathyNewChatroomDialog: Make sure we use the TpRoomList that correspond to selected...
authorXavier Claessens <xavier.claessens@collabora.co.uk>
Mon, 10 Jun 2013 15:09:19 +0000 (17:09 +0200)
committerXavier Claessens <xavier.claessens@collabora.co.uk>
Tue, 11 Jun 2013 09:33:32 +0000 (11:33 +0200)
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

src/empathy-new-chatroom-dialog.c

index 5b9fa94c69308f29a51c2a1e2d1eaf3702e03016..3ce59ab8fdb3c63781a0112b25c6e0ed1aaae945 100644 (file)
@@ -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