]> spindle.queued.net Git - midori/commitdiff
Finish soup messaging cleanly and free private data
authorChristian Dywan <christian@twotoasts.de>
Fri, 24 Oct 2008 17:58:58 +0000 (19:58 +0200)
committerChristian Dywan <christian@twotoasts.de>
Fri, 24 Oct 2008 17:58:58 +0000 (19:58 +0200)
katze/katze-net.c

index fdbf938aa8135e5132e35e82f10a1123d620beaf..23a0d258670cfc4a976aa5fdfe73783832c24882 100644 (file)
@@ -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;
     }