store the GSource in priv, don't ref the session. Otherwise the session
authorDan Winship <danw@src.gnome.org>
Tue, 30 Sep 2008 15:43:17 +0000 (15:43 +0000)
committerDan Winship <danw@src.gnome.org>
Tue, 30 Sep 2008 15:43:17 +0000 (15:43 +0000)
commitdd40c1515f1687c614f2dc670aca49fad8ad2088
treed655241a87d19acc345dcdba90c09172426c0227
parent91c185ead4d7d5560887d7fa13aeecf9ed320998
store the GSource in priv, don't ref the session. Otherwise the session

* libsoup/soup-session-async.c (do_idle_run_queue): store the
GSource in priv, don't ref the session. Otherwise the session
won't get destroyed if you abort it and then don't return to its
main loop. (addendum to #498509, Arnout Vandecappelle)
(finalize): Destroy the idle_run_queue source when finalizing.
(run_queue, got_connection): Ref the session when calling
soup_connection_connect_async(), and do a
do_idle_run_queue()+unref in got_connection, to ensure correct
handling regardless of what the application does with its own ref
on the session.
(final_finished): Likewise, ref/do_idle_run_queue/unref rather
than calling run_queue directly and playing with weak pointers.

* libsoup/soup-session.c (connect_result): ref the session around
the cancel-if-error loop

Fixes #533473, crash in seahorse when connecting to a
non-responsive key server.

* tests/misc-test.c (do_callback_unref_test): Add a test for the
bug in #533473.

* tests/test-utils.c (soup_test_session_abort_unref): abort and
unref a SoupSession, and consider it an error if the session still
exists afterward. Suggested by Arnout Vandecappelle.
(test_server_shutdown): Likewise, consider it an error if the
server is leaked.

* tests/*.c: Use soup_test_session_abort_unref().

svn path=/trunk/; revision=1168
14 files changed:
ChangeLog
libsoup/soup-session-async.c
libsoup/soup-session.c
tests/auth-test.c
tests/chunk-test.c
tests/context-test.c
tests/continue-test.c
tests/misc-test.c
tests/ntlm-test.c
tests/pull-api.c
tests/redirect-test.c
tests/test-utils.c
tests/test-utils.h
tests/xmlrpc-test.c