[libsoup] Fix a crash when cancelling a message from a "restarted" handler



commit 74ed15a45689af40d6f210a6624fba0ea829055b
Author: Dan Winship <danw gnome org>
Date:   Tue Apr 28 12:23:03 2009 -0400

    Fix a crash when cancelling a message from a "restarted" handler
    
    SoupSessionAsync was mistakenly leaving its own "restarted" handler connected
    even after "finished" was emitted. misc-test was supposed to catch that, but
    it was using SoupSessionSync rather than Async. Changed it to use Async since
    Async adds some signal handlers of its own, while Sync does not.
    
    Fixes #380193, reported by Gustavo Noronha
---
 libsoup/soup-session-async.c |    1 +
 tests/misc-test.c            |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libsoup/soup-session-async.c b/libsoup/soup-session-async.c
index d9d17e3..a492ee5 100644
--- a/libsoup/soup-session-async.c
+++ b/libsoup/soup-session-async.c
@@ -327,6 +327,7 @@ final_finished (SoupMessage *req, gpointer user_data)
 
 	if (!SOUP_MESSAGE_IS_STARTING (req)) {
 		g_signal_handlers_disconnect_by_func (req, final_finished, item);
+		g_signal_handlers_disconnect_by_func (req, request_restarted, item);
 		if (item->callback)
 			item->callback (session, req, item->callback_data);
 
diff --git a/tests/misc-test.c b/tests/misc-test.c
index 52b7bec..70415d3 100644
--- a/tests/misc-test.c
+++ b/tests/misc-test.c
@@ -241,7 +241,7 @@ do_msg_reuse_test (void)
 
 	signal_ids = g_signal_list_ids (SOUP_TYPE_MESSAGE, &n_signal_ids);
 
-	session = soup_test_session_new (SOUP_TYPE_SESSION_SYNC, NULL);
+	session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
 	g_signal_connect (session, "authenticate",
 			  G_CALLBACK (reuse_test_authenticate), NULL);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]