From 2cdb1202afaec882ca949e0a8fbeea2b1c1b50dd Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 10 May 2011 18:52:07 +0100 Subject: [PATCH] set_status_to_connected: do nothing if we already disconnected Now that we're making more use of GAsyncResult, we can easily get into this situation: * all but one of the preconditions for being CONNECTED have happened; the remaining one uses GAsyncResult (currently that can only be conn_presence_set_initial_presence_async) * conn_presence_set_initial_presence succeeds, and schedules a call to its callback in an idle; we are now ready to be CONNECTED, but because of GAsyncResult calling conventions, we won't call the callback right now * someone calls Disconnect(), and we do so, synchronously; we are now DISCONNECTED * the idle goes off and connection_initial_presence_cb is called, with success, while DISCONNECTED! Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37078 --- src/connection.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/connection.c b/src/connection.c index 3112321..5e10ff8 100644 --- a/src/connection.c +++ b/src/connection.c @@ -2682,6 +2682,13 @@ set_status_to_connected (GabbleConnection *conn) { TpBaseConnection *base = (TpBaseConnection *) conn; + if (base->status == TP_CONNECTION_STATUS_DISCONNECTED) + { + /* We already failed to connect, but at the time an async thing was + * still pending, and now it has finished. Do nothing special. */ + return; + } + if (conn->features & GABBLE_CONNECTION_FEATURES_PEP) { const gchar *ifaces[] = { GABBLE_IFACE_OLPC_BUDDY_INFO, -- 1.7.5.1