From ea811042efc928a68c7d176dac835f3ed577d72e Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Wed, 29 Oct 2008 10:36:45 -0300 Subject: [PATCH] obexd: Removes the disconnect watch when the session is freed --- obexd/client/session.c | 5 ++++- obexd/client/session.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/obexd/client/session.c b/obexd/client/session.c index 7e3519c74..90086350a 100644 --- a/obexd/client/session.c +++ b/obexd/client/session.c @@ -72,6 +72,9 @@ static void session_unref(struct session_data *session) if (g_atomic_int_dec_and_test(&session->refcount) == FALSE) return; + if (session->agent_watch) + g_dbus_remove_watch(session->conn, session->agent_watch); + if (session->agent_name != NULL) { DBusMessage *message; @@ -598,7 +601,7 @@ static DBusMessage *assign_agent(DBusConnection *connection, session->agent_name = g_strdup(sender); session->agent_path = g_strdup(path); - g_dbus_add_disconnect_watch(connection, sender, + session->agent_watch = g_dbus_add_disconnect_watch(connection, sender, agent_disconnected, session, NULL); return dbus_message_new_method_return(message); diff --git a/obexd/client/session.h b/obexd/client/session.h index dbef86cbc..06e0c774b 100644 --- a/obexd/client/session.h +++ b/obexd/client/session.h @@ -49,6 +49,7 @@ struct session_data { gchar *filename; gchar *agent_name; gchar *agent_path; + guint agent_watch; GPtrArray *pending; };