[ostree] pull: Avoid leaking signal handlers across fetch requests



commit 889b86e96ddc64c61f83cb000367288b445cf838
Author: Colin Walters <walters verbum org>
Date:   Mon Jun 29 21:56:03 2015 -0400

    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 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/libostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c
index ee74982..46b8c44 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]