From 36860b449e76f4f4f27a5f02c20898aa9868bb20 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sat, 15 Feb 2020 22:27:34 -0700 Subject: [PATCH] libsysprof-capture: unref GSource after attaching --- src/libsysprof-capture/mapped-ring-buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-capture/mapped-ring-buffer.c b/src/libsysprof-capture/mapped-ring-buffer.c index 8900beb9..061656ed 100644 --- a/src/libsysprof-capture/mapped-ring-buffer.c +++ b/src/libsysprof-capture/mapped-ring-buffer.c @@ -587,6 +587,7 @@ mapped_ring_buffer_create_source_full (MappedRingBuffer *self, GDestroyNotify destroy) { MappedRingSource *source; + guint ret; g_return_val_if_fail (self != NULL, 0); g_return_val_if_fail (source_func != NULL, 0); @@ -595,8 +596,10 @@ mapped_ring_buffer_create_source_full (MappedRingBuffer *self, source->self = mapped_ring_buffer_ref (self); g_source_set_callback ((GSource *)source, (GSourceFunc)source_func, user_data, destroy); g_source_set_name ((GSource *)source, "MappedRingSource"); + ret = g_source_attach ((GSource *)source, g_main_context_default ()); + g_source_unref ((GSource *)source); - return g_source_attach ((GSource *)source, g_main_context_default ()); + return ret; } guint