From cceb761559fc97c2a066fb943b2f0f46fcfddc6a Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Mon, 10 Nov 2008 10:48:43 -0300 Subject: [PATCH] obexd: Closes the session when the client leaves the bus --- obexd/client/session.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/obexd/client/session.c b/obexd/client/session.c index bdd55d352..3143cc0cb 100644 --- a/obexd/client/session.c +++ b/obexd/client/session.c @@ -783,6 +783,12 @@ static DBusMessage *close_session(DBusConnection *connection, return dbus_message_new_method_return(message); } +static void owner_disconnected(DBusConnection *connection, void *user_data) +{ + struct session_data *session = user_data; + + session_shutdown(session); +} static GDBusMethodTable session_methods[] = { { "GetProperties", "", "a{sv}", get_properties }, @@ -1439,6 +1445,9 @@ int session_register(struct session_data *session) return -EIO; } + g_dbus_add_disconnect_watch(session->conn, session->owner, + owner_disconnected, session, NULL); + session_ref(session); return 0; -- 2.47.3