obexd: Removes the disconnect watch when the session is freed

This commit is contained in:
Vinicius Costa Gomes 2008-10-29 10:36:45 -03:00 committed by Marcel Holtmann
parent f97b09d4e3
commit ea811042ef
2 changed files with 5 additions and 1 deletions

View File

@ -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);

View File

@ -49,6 +49,7 @@ struct session_data {
gchar *filename;
gchar *agent_name;
gchar *agent_path;
guint agent_watch;
GPtrArray *pending;
};