[libsoup] soup-session: unpause messages when cancelling them
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-session: unpause messages when cancelling them
- Date: Wed, 11 Apr 2012 13:58:21 +0000 (UTC)
commit 822048b8d78fb6fb3939051945ec979343438f5a
Author: Dan Winship <danw gnome org>
Date: Wed Apr 11 09:56:37 2012 -0400
soup-session: unpause messages when cancelling them
Otherwise paused messages get leaked when you abort the session.
https://bugzilla.gnome.org/show_bug.cgi?id=673905
libsoup/soup-session.c | 1 +
tests/misc-test.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 7215b61..2cfcc27 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -2285,6 +2285,7 @@ cancel_message (SoupSession *session, SoupMessage *msg, guint status_code)
item = soup_message_queue_lookup (priv->queue, msg);
g_return_if_fail (item != NULL);
+ item->paused = FALSE;
soup_message_set_status (msg, status_code);
g_cancellable_cancel (item->cancellable);
diff --git a/tests/misc-test.c b/tests/misc-test.c
index 4b2663f..261672c 100644
--- a/tests/misc-test.c
+++ b/tests/misc-test.c
@@ -827,6 +827,30 @@ do_idle_on_dispose_test (void)
g_main_context_unref (async_context);
}
+static void
+do_pause_abort_test (void)
+{
+ SoupSession *session;
+ SoupMessage *msg;
+ gpointer ptr;
+
+ debug_printf (1, "\nTesting paused messages don't get leaked on abort\n");
+
+ session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
+
+ msg = soup_message_new_from_uri ("GET", base_uri);
+ soup_session_queue_message (session, msg, NULL, NULL);
+ soup_session_pause_message (session, msg);
+
+ g_object_add_weak_pointer (G_OBJECT (msg), &ptr);
+ soup_test_session_abort_unref (session);
+
+ if (ptr) {
+ debug_printf (1, " msg was leaked\n");
+ errors++;
+ }
+}
+
int
main (int argc, char **argv)
{
@@ -863,6 +887,7 @@ main (int argc, char **argv)
do_dot_dot_test ();
do_ipv6_test ();
do_idle_on_dispose_test ();
+ do_pause_abort_test ();
soup_uri_free (base_uri);
soup_uri_free (ssl_base_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]