[libsoup/gnome-3-6] soup-message-io: fix crash when doing unpause+cancel



commit 460419aefd64f15e27a21951519187fba656e403
Author: Dan Winship <danw gnome org>
Date:   Tue Dec 11 10:52:00 2012 +0100

    soup-message-io: fix crash when doing unpause+cancel
    
    soup_message_io_stop() was unreffing unpause_source (if it was set),
    but it didn't actually own a ref on it, so this would crash.
    Fortunately this would only happen if you unpaused a message and then
    immediately cancelled it, which isn't very common. Fixes a sporadic
    chunk-test crash though.

 libsoup/soup-message-io.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-message-io.c b/libsoup/soup-message-io.c
index 52af22b..ab854fe 100644
--- a/libsoup/soup-message-io.c
+++ b/libsoup/soup-message-io.c
@@ -1106,6 +1106,7 @@ soup_message_io_pause (SoupMessage *msg)
 
 	if (io->unpause_source) {
 		g_source_destroy (io->unpause_source);
+		g_source_unref (io->unpause_source);
 		io->unpause_source = NULL;
 	}
 
@@ -1119,6 +1120,8 @@ io_unpause_internal (gpointer msg)
 	SoupMessageIOData *io = priv->io_data;
 
 	g_return_val_if_fail (io != NULL, FALSE);
+
+	g_source_unref (io->unpause_source);
 	io->unpause_source = NULL;
 	io->paused = FALSE;
 
@@ -1145,7 +1148,7 @@ soup_message_io_unpause (SoupMessage *msg)
 
 	if (!io->blocking) {
 		if (!io->unpause_source) {
-			io->unpause_source = soup_add_completion (
+			io->unpause_source = soup_add_completion_reffed (
 				io->async_context, io_unpause_internal, msg);
 		}
 	} else



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