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 <withnall@endlessm.com>

Helps: #1515
This commit is contained in:
Philip Withnall 2020-02-20 12:40:30 +00:00
parent cc11c79e4b
commit bcee182a49

View File

@ -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: