diff options
author | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2010-08-19 13:41:49 +0100 |
---|---|---|
committer | Vivek Dasmohapatra <vivek@collabora.co.uk> | 2010-08-19 14:50:03 +0100 |
commit | ab8dbf1d6d5527a79bef37316cb7f895870d62e7 (patch) | |
tree | 5f5e3ea7b5cbf09bb66fa64b27c920876c587b17 | |
parent | 0fc5bed249202727b7eb034ab37502e4a024afb1 (diff) | |
download | telepathy-mission-control-5.4.tar.gz |
Drop the McdConnection probation timer when the TpConnection is releasedtelepathy-mission-control-5.4
Also: Check that we haven't accidentally called the timer callback after
releasing the TpConnection, as this avoids a SEGV (and g_warn if we find
ourselves in this situation)
-rw-r--r-- | src/mcd-connection.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/mcd-connection.c b/src/mcd-connection.c index 44294606..aaf9eb3a 100644 --- a/src/mcd-connection.c +++ b/src/mcd-connection.c @@ -1053,15 +1053,26 @@ mcd_connection_reconnect (McdConnection *connection) static gboolean mcd_connection_probation_ended_cb (gpointer user_data) { - McdConnection *self = user_data; + McdConnection *self = MCD_CONNECTION (user_data); + McdConnectionPrivate *priv = MCD_CONNECTION_PRIV (self); /* We've been connected for PROBATION_SEC seconds. We can probably now * assume that the connection is stable */ - DEBUG ("probation finished, assuming connection is stable: %s", - tp_proxy_get_object_path (self->priv->tp_conn)); + if (priv->tp_conn != NULL) + { + DEBUG ("probation finished, assuming connection is stable: %s", + tp_proxy_get_object_path (self->priv->tp_conn)); + self->priv->probation_drop_count = 0; + self->priv->reconnect_interval = INITIAL_RECONNECTION_TIME; + } + else /* probation timer survived beyond its useful life */ + { + g_warning ("probation error: timer should have been removed when the " + "TpConnection was released"); + } + self->priv->probation_timer = 0; - self->priv->probation_drop_count = 0; - self->priv->reconnect_interval = INITIAL_RECONNECTION_TIME; + return FALSE; } @@ -1934,6 +1945,15 @@ _mcd_connection_release_tp_connection (McdConnection *connection) G_CALLBACK (mcd_connection_invalidated_cb), connection); _mcd_connection_call_disconnect (connection); + + /* the tp_connection has gone away, so we no longer need (or want) * + the probation timer to go off: there's nothing for it to check */ + if (priv->probation_timer > 0) + { + g_source_remove (priv->probation_timer); + priv->probation_timer = 0; + } + g_object_unref (priv->tp_conn); priv->tp_conn = NULL; _mcd_account_tp_connection_changed (priv->account); |