From bcee182a499918e97b3aa6ca27176bab2fcb302e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 20 Feb 2020 12:40:30 +0000 Subject: [PATCH] gdbusconnection: Drop an unnecessary GMainContext reference `CallDestroyNotifyData` never uses that `GMainContext`, and holding a ref to it could cause reference count cycles if the `GMainContext` is no longer being iterated. Signed-off-by: Philip Withnall Helps: #1515 --- gio/gdbusconnection.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 67496be5b..5f5fad0f1 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -222,7 +222,6 @@ typedef struct { GDestroyNotify callback; gpointer user_data; - GMainContext *context; } CallDestroyNotifyData; static gboolean @@ -236,8 +235,6 @@ call_destroy_notify_data_in_idle (gpointer user_data) static void call_destroy_notify_data_free (CallDestroyNotifyData *data) { - if (data->context != NULL) - g_main_context_unref (data->context); g_free (data); } @@ -263,9 +260,6 @@ call_destroy_notify (GMainContext *context, data = g_new0 (CallDestroyNotifyData, 1); data->callback = callback; data->user_data = user_data; - data->context = context; - if (data->context != NULL) - g_main_context_ref (data->context); idle_source = g_idle_source_new (); g_source_set_priority (idle_source, G_PRIORITY_DEFAULT); @@ -274,7 +268,7 @@ call_destroy_notify (GMainContext *context, data, (GDestroyNotify) call_destroy_notify_data_free); g_source_set_name (idle_source, "[gio] call_destroy_notify_data_in_idle"); - g_source_attach (idle_source, data->context); + g_source_attach (idle_source, context); g_source_unref (idle_source); out: