mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01:00
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
This commit is contained in:
parent
85882094df
commit
005dfeacba
@ -3175,18 +3175,21 @@ g_dbus_connection_remove_filter (GDBusConnection *connection,
|
|||||||
guint filter_id)
|
guint filter_id)
|
||||||
{
|
{
|
||||||
guint n;
|
guint n;
|
||||||
|
gboolean found;
|
||||||
FilterData *to_destroy;
|
FilterData *to_destroy;
|
||||||
|
|
||||||
g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
|
g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
|
||||||
g_return_if_fail (check_initialized (connection));
|
g_return_if_fail (check_initialized (connection));
|
||||||
|
|
||||||
CONNECTION_LOCK (connection);
|
CONNECTION_LOCK (connection);
|
||||||
|
found = FALSE;
|
||||||
to_destroy = NULL;
|
to_destroy = NULL;
|
||||||
for (n = 0; n < connection->filters->len; n++)
|
for (n = 0; n < connection->filters->len; n++)
|
||||||
{
|
{
|
||||||
FilterData *data = connection->filters->pdata[n];
|
FilterData *data = connection->filters->pdata[n];
|
||||||
if (data->id == filter_id)
|
if (data->id == filter_id)
|
||||||
{
|
{
|
||||||
|
found = TRUE;
|
||||||
g_ptr_array_remove_index (connection->filters, n);
|
g_ptr_array_remove_index (connection->filters, n);
|
||||||
data->ref_count--;
|
data->ref_count--;
|
||||||
if (data->ref_count == 0)
|
if (data->ref_count == 0)
|
||||||
@ -3204,7 +3207,7 @@ g_dbus_connection_remove_filter (GDBusConnection *connection,
|
|||||||
g_main_context_unref (to_destroy->context);
|
g_main_context_unref (to_destroy->context);
|
||||||
g_free (to_destroy);
|
g_free (to_destroy);
|
||||||
}
|
}
|
||||||
else
|
else if (!found)
|
||||||
{
|
{
|
||||||
g_warning ("g_dbus_connection_remove_filter: No filter found for filter_id %d", filter_id);
|
g_warning ("g_dbus_connection_remove_filter: No filter found for filter_id %d", filter_id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user