diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-25 18:10:27 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-25 18:38:51 +0800 |
commit | 3702cb89aa2fe19bea22e280b55fc71e677e9568 (patch) | |
tree | 0e224441ba634e16195fc69acd8522b87dadd408 /libempathy/empathy-account.c | |
parent | 15066163b889c48346948a9b0b963c37ec124d1c (diff) | |
download | gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.tar gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.tar.gz gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.tar.bz2 gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.tar.lz gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.tar.xz gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.tar.zst gsoc2013-empathy-3702cb89aa2fe19bea22e280b55fc71e677e9568.zip |
Fix a crash caused by tp-glib emitting invalidated in dispose
When an TpProxy is disposed tp-glib emits the invalidated signal. This meant
that when EmpathyAccount disposed its TpConnection as a result of the account
manager saying the connection was gone, the invalidated signal was emitted. As
a result of which the TpConnection would get disposed again...
Diffstat (limited to 'libempathy/empathy-account.c')
-rw-r--r-- | libempathy/empathy-account.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c index 091950880..39b5d0f08 100644 --- a/libempathy/empathy-account.c +++ b/libempathy/empathy-account.c @@ -608,15 +608,19 @@ static void empathy_account_free_connection (EmpathyAccount *account) { EmpathyAccountPriv *priv = GET_PRIV (account); + TpConnection *conn; + + if (priv->connection == NULL) + return; + + conn = priv->connection; + priv->connection = NULL; if (priv->connection_invalidated_id != 0) - g_signal_handler_disconnect (priv->connection, - priv->connection_invalidated_id); + g_signal_handler_disconnect (conn, priv->connection_invalidated_id); priv->connection_invalidated_id = 0; - if (priv->connection != NULL) - g_object_unref (priv->connection); - priv->connection = NULL; + g_object_unref (conn); } void @@ -853,12 +857,7 @@ _empathy_account_connection_invalidated_cb (TpProxy *self, g_assert (priv->connection == TP_CONNECTION (self)); - g_signal_handler_disconnect (priv->connection, - priv->connection_invalidated_id); - priv->connection_invalidated_id = 0; - - g_object_unref (priv->connection); - priv->connection = NULL; + empathy_account_free_connection (account); g_object_notify (G_OBJECT (account), "connection"); } @@ -878,15 +877,7 @@ _empathy_account_set_connection (EmpathyAccount *account, return; } - if (priv->connection != NULL) - { - g_signal_handler_disconnect (priv->connection, - priv->connection_invalidated_id); - priv->connection_invalidated_id = 0; - - g_object_unref (priv->connection); - priv->connection = NULL; - } + empathy_account_free_connection (account); if (tp_strdiff ("/", path)) { |