From b53a2ebb3792425df352bccac2b417d356ada845 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 24 Oct 2008 19:58:58 +0200 Subject: [PATCH] Finish soup messaging cleanly and free private data --- katze/katze-net.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/katze/katze-net.c b/katze/katze-net.c index fdbf938a..23a0d258 100644 --- a/katze/katze-net.c +++ b/katze/katze-net.c @@ -168,7 +168,10 @@ katze_net_got_headers_cb (SoupMessage* msg, } if (!priv->status_cb (request, priv->user_data)) + { + g_signal_handlers_disconnect_by_func (msg, katze_net_got_headers_cb, priv); soup_session_cancel_message (priv->net->session, msg, msg->status_code); + } } static void @@ -202,6 +205,12 @@ katze_net_got_body_cb (SoupMessage* msg, } priv->transfer_cb (request, priv->user_data); +} + +static void +katze_net_finished_cb (SoupMessage* msg, + KatzeNetPriv* priv) +{ katze_net_priv_free (priv); } #endif @@ -329,6 +338,8 @@ katze_net_load_uri (KatzeNet* net, if (transfer_cb) g_signal_connect (msg, "got-body", G_CALLBACK (katze_net_got_body_cb), priv); + g_signal_connect (msg, "finished", + G_CALLBACK (katze_net_finished_cb), priv); soup_session_queue_message (net->session, msg, NULL, NULL); return; } -- 2.39.5