aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-30 01:28:56 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-30 01:44:03 +0800
commitbb2d63c7d3964a3cd68e6667a19907aa72bb686b (patch)
treeaeea7ded63d0e491d039bce37d21c1999b3faa61 /libempathy
parent68cf4c663ae37ef031adfbe4afaecc218df235e6 (diff)
downloadgsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.tar
gsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.tar.gz
gsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.tar.bz2
gsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.tar.lz
gsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.tar.xz
gsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.tar.zst
gsoc2013-empathy-bb2d63c7d3964a3cd68e6667a19907aa72bb686b.zip
Unref the connection if it fails to become ready or is invalidated
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c
index db2ca1f56..5cf489769 100644
--- a/libempathy/empathy-account.c
+++ b/libempathy/empathy-account.c
@@ -607,6 +607,21 @@ empathy_account_class_init (EmpathyAccountClass *empathy_account_class)
G_TYPE_NONE, 0);
}
+static void
+empathy_account_free_connection (EmpathyAccount *account)
+{
+ EmpathyAccountPriv *priv = GET_PRIV (account);
+
+ if (priv->connection_invalidated_id != 0)
+ g_signal_handler_disconnect (priv->connection,
+ priv->connection_invalidated_id);
+ priv->connection_invalidated_id = 0;
+
+ if (priv->connection != NULL)
+ g_object_unref (priv->connection);
+ priv->connection = NULL;
+}
+
void
empathy_account_dispose (GObject *object)
{
@@ -618,14 +633,7 @@ empathy_account_dispose (GObject *object)
priv->dispose_has_run = TRUE;
- if (priv->connection_invalidated_id != 0)
- g_signal_handler_disconnect (priv->connection,
- priv->connection_invalidated_id);
- priv->connection_invalidated_id = 0;
-
- if (priv->connection != NULL)
- g_object_unref (priv->connection);
- priv->connection = NULL;
+ empathy_account_free_connection (self);
/* release any references held by the object here */
if (G_OBJECT_CLASS (empathy_account_parent_class)->dispose != NULL)
@@ -785,13 +793,12 @@ empathy_account_connection_ready_cb (TpConnection *connection,
gpointer user_data)
{
EmpathyAccount *account = EMPATHY_ACCOUNT (user_data);
- EmpathyAccountPriv *priv = GET_PRIV (account);
if (error != NULL)
{
DEBUG ("(%s) Connection failed to become ready: %s",
empathy_account_get_unique_name (account), error->message);
- priv->connection = NULL;
+ empathy_account_free_connection (account);
}
else
{