[glib: 6/17] gdbusconnection: Drop an unnecessary GMainContext reference
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 6/17] gdbusconnection: Drop an unnecessary GMainContext reference
- Date: Mon, 24 Feb 2020 10:02:00 +0000 (UTC)
commit bcee182a499918e97b3aa6ca27176bab2fcb302e
Author: Philip Withnall <withnall endlessm com>
Date: Thu Feb 20 12:40:30 2020 +0000
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
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:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]