aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <treitter@gmail.com>2010-02-08 18:30:18 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-02-08 18:30:18 +0800
commit7d2b2ea25261c064505c22dba1918bb781b215e6 (patch)
tree03e017a37d313b340b5e285cb35390ae1528480a
parent47ce699f4a9b8bd726330c39995f508fa819b85d (diff)
downloadgsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.tar
gsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.tar.gz
gsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.tar.bz2
gsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.tar.lz
gsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.tar.xz
gsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.tar.zst
gsoc2013-empathy-7d2b2ea25261c064505c22dba1918bb781b215e6.zip
Ensure that the EmpathyIdle is not used in account_manager_ready_cb after being finalized
Fixes #608813
-rw-r--r--libempathy/empathy-idle.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 14d7c4813..e9bb1a4ac 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -64,6 +64,7 @@ typedef struct {
guint ext_away_timeout;
TpAccountManager *manager;
+ gulong idle_presence_changed_id;
/* pointer to a TpAccount --> glong of time of connection */
GHashTable *connect_times;
@@ -312,6 +313,12 @@ idle_finalize (GObject *object)
priv->state_change_signal_id);
priv->state_change_signal_id = 0;
+ if (priv->manager != NULL) {
+ g_signal_handler_disconnect (priv->manager,
+ priv->idle_presence_changed_id);
+ g_object_unref (priv->manager);
+ }
+
g_object_unref (priv->connectivity);
g_hash_table_destroy (priv->connect_times);
@@ -478,14 +485,19 @@ account_manager_ready_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
- EmpathyIdle *idle = EMPATHY_IDLE (user_data);
+ EmpathyIdle *idle = user_data;
TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
- EmpathyIdlePriv *priv = GET_PRIV (idle);
+ EmpathyIdlePriv *priv;
TpConnectionPresenceType state;
gchar *status, *status_message;
GList *accounts, *l;
GError *error = NULL;
+ /* In case we've been finalized before reading this callback */
+ if (idle_singleton == NULL)
+ return;
+
+ priv = GET_PRIV (idle);
priv->ready = TRUE;
if (!tp_account_manager_prepare_finish (account_manager, result, &error)) {
@@ -526,7 +538,8 @@ empathy_idle_init (EmpathyIdle *idle)
tp_account_manager_prepare_async (priv->manager, NULL,
account_manager_ready_cb, idle);
- g_signal_connect (priv->manager, "most-available-presence-changed",
+ priv->idle_presence_changed_id = g_signal_connect (priv->manager,
+ "most-available-presence-changed",
G_CALLBACK (idle_presence_changed_cb), idle);
priv->gs_proxy = dbus_g_proxy_new_for_name (tp_get_bus (),