If g_dbus_client_set_proxy_handlers gets called from within a proxy_removed callback, the code may end up refreshing the proxy's properties and incorrectly access the client's proxy_list as it gets freed. This patch fixes this, so that get_managed_objects does nothing if it gets called during a service disconnect. --- gdbus/client.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdbus/client.c b/gdbus/client.c index eb68a0f..8c32084 100644 --- a/gdbus/client.c +++ b/gdbus/client.c @@ -52,6 +52,7 @@ struct GDBusClient { void *connect_data; GDBusWatchFunction disconn_func; gboolean connected; + gboolean in_disconn; void *disconn_data; GDBusMessageFunction signal_func; void *signal_data; @@ -1107,6 +1108,9 @@ static void get_managed_objects(GDBusClient *client) { DBusMessage *msg; + if (client->in_disconn) + return; + if (!client->proxy_added && !client->proxy_removed) { refresh_properties(client); return; @@ -1156,6 +1160,8 @@ static void service_disconnect(DBusConnection *conn, void *user_data) { GDBusClient *client = user_data; + client->in_disconn = TRUE; + g_list_free_full(client->proxy_list, proxy_free); client->proxy_list = NULL; @@ -1163,6 +1169,8 @@ static void service_disconnect(DBusConnection *conn, void *user_data) client->disconn_func(conn, client->disconn_data); client->connected = FALSE; } + + client->in_disconn = FALSE; } static DBusHandlerResult message_filter(DBusConnection *connection, -- 2.2.0.rc0.207.ga3a616c -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html