From 889b86e96ddc64c61f83cb000367288b445cf838 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 29 Jun 2015 21:56:03 -0400 Subject: [PATCH] pull: Avoid leaking signal handlers across fetch requests libsoup will cache sessions, so it might be the case that we get a reused session when pulling from the same repo multiple times in one process. In this case we were leaking signal connections, which caused callbacks into freed memory with bad consequences. Fix it by tying the signal connection to the object lifetime. --- src/libostree/ostree-fetcher.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c index ee749825..46b8c44a 100644 --- a/src/libostree/ostree-fetcher.c +++ b/src/libostree/ostree-fetcher.c @@ -201,10 +201,10 @@ _ostree_fetcher_init (OstreeFetcher *self) self->max_outstanding = 3 * max_conns; - g_signal_connect (self->session, "request-started", - G_CALLBACK (on_request_started), self); - g_signal_connect (self->session, "request-unqueued", - G_CALLBACK (on_request_unqueued), self); + g_signal_connect_object (self->session, "request-started", + G_CALLBACK (on_request_started), self, 0); + g_signal_connect_object (self->session, "request-unqueued", + G_CALLBACK (on_request_unqueued), self, 0); self->sending_messages = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify)g_object_unref);