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.
This commit is contained in:
Colin Walters 2015-06-29 21:56:03 -04:00
parent f0a02fbf20
commit 889b86e96d
1 changed files with 4 additions and 4 deletions

View File

@ -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);