From 005dfeacba142af598d57f28da1e7f79c17d8fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Wed, 1 Mar 2017 11:18:21 +0100 Subject: [PATCH] gdbus: fix false positive g_warning() in remove_filter() The GDBus thread might be holding a ref while requesting to remove the filter. https://bugzilla.gnome.org/show_bug.cgi?id=779409 --- gio/gdbusconnection.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 17b074188..7c88a4eb3 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -3175,18 +3175,21 @@ g_dbus_connection_remove_filter (GDBusConnection *connection, guint filter_id) { guint n; + gboolean found; FilterData *to_destroy; g_return_if_fail (G_IS_DBUS_CONNECTION (connection)); g_return_if_fail (check_initialized (connection)); CONNECTION_LOCK (connection); + found = FALSE; to_destroy = NULL; for (n = 0; n < connection->filters->len; n++) { FilterData *data = connection->filters->pdata[n]; if (data->id == filter_id) { + found = TRUE; g_ptr_array_remove_index (connection->filters, n); data->ref_count--; if (data->ref_count == 0) @@ -3204,7 +3207,7 @@ g_dbus_connection_remove_filter (GDBusConnection *connection, g_main_context_unref (to_destroy->context); g_free (to_destroy); } - else + else if (!found) { g_warning ("g_dbus_connection_remove_filter: No filter found for filter_id %d", filter_id); }