diff options
author | Dan Winship <danw@gnome.org> | 2012-02-13 22:05:43 -0500 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-02-13 22:05:43 -0500 |
commit | 64bdfe9eb24e219b071a06ae03cec49f15b1b71b (patch) | |
tree | f493a4182aa9d8b9b05d625b5bd7a9114a9eb3a5 /tests | |
parent | 1c3878284295d3d650a4b7af2d54d61b36b9668f (diff) | |
download | libsoup-64bdfe9eb24e219b071a06ae03cec49f15b1b71b.tar.gz libsoup-64bdfe9eb24e219b071a06ae03cec49f15b1b71b.tar.bz2 libsoup-64bdfe9eb24e219b071a06ae03cec49f15b1b71b.zip |
SoupSessionAsync: don't queue idles from dispose()
SoupSession does a soup_session_abort() from dispose(), which had the
effect in SoupSessionAsync of queueing an idle (to check if new
messages could be sent now that old connections had been closed). This
causes problems if the session was disposed from a thread other than
the one that its GMainContext is running in, which is weird, and also
incompatible with some garbage-collected runtimes. So fix that.
https://bugzilla.gnome.org/show_bug.cgi?id=667364
Diffstat (limited to 'tests')
-rw-r--r-- | tests/misc-test.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/misc-test.c b/tests/misc-test.c index 321d41f5..82d2d735 100644 --- a/tests/misc-test.c +++ b/tests/misc-test.c @@ -1272,6 +1272,38 @@ do_ipv6_test (void) soup_test_server_quit_unref (ipv6_server); } +static void +do_idle_on_dispose_test (void) +{ + SoupSession *session; + SoupMessage *msg; + GMainContext *async_context; + + debug_printf (1, "\nTesting SoupSessionAsync dispose behavior\n"); + + async_context = g_main_context_new (); + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, + SOUP_SESSION_ASYNC_CONTEXT, async_context, + NULL); + + msg = soup_message_new_from_uri ("GET", base_uri); + soup_session_send_message (session, msg); + g_object_unref (msg); + + while (g_main_context_iteration (async_context, FALSE)) + ; + + g_object_run_dispose (G_OBJECT (session)); + + if (g_main_context_iteration (async_context, FALSE)) { + debug_printf (1, " idle was queued!\n"); + errors++; + } + + g_object_unref (session); + g_main_context_unref (async_context); +} + int main (int argc, char **argv) { @@ -1311,6 +1343,7 @@ main (int argc, char **argv) do_non_persistent_connection_test (); do_dot_dot_test (); do_ipv6_test (); + do_idle_on_dispose_test (); soup_uri_free (base_uri); soup_uri_free (ssl_base_uri); |