[evolution-patches] soup refcounting update



Turns out my previous patch was avoiding some problems by virtue of
never freeing readers and writers. Ha ha. With this, I can use connector
without valgrind complaining about either accessing freed memory or
leaking.

(Well, not really, it still leaks read buffers occasionally, but that's
nothing new.)

-- Dan


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsoup/ChangeLog,v
retrieving revision 1.313
diff -u -r1.313 ChangeLog
--- ChangeLog	17 Jun 2003 12:24:10 -0000	1.313
+++ ChangeLog	19 Jun 2003 15:52:54 -0000
@@ -1,3 +1,13 @@
+2003-06-19  Dan Winship  <danw ximian com>
+
+	* libsoup/soup-queue.c (soup_queue_read_done_cb): unref the
+	old read_tag before changing/clearing it.
+	(soup_queue_write_done_cb): Likewise with the write_tag.
+
+	* libsoup/soup-transfer.c (issue_final_callback): ref the reader
+	around the stop+callback.
+	(soup_transfer_write_cb): Likewise.
+
 2003-06-12  Dan Winship  <danw ximian com>
 
 	* libsoup/soup-transfer.c (SoupReader, SoupWriter): add a
Index: libsoup/soup-queue.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-queue.c,v
retrieving revision 1.85
diff -u -r1.85 soup-queue.c
--- libsoup/soup-queue.c	17 Jun 2003 12:24:12 -0000	1.85
+++ libsoup/soup-queue.c	19 Jun 2003 15:52:56 -0000
@@ -258,6 +258,8 @@
 	req->response.length = data->length;
 	req->response.body = data->body;
 
+	soup_transfer_read_unref (req->priv->read_tag);
+
 	if (req->errorclass == SOUP_ERROR_CLASS_INFORMATIONAL) {
 		GIOChannel *channel;
 		gboolean overwrt;
@@ -278,7 +280,7 @@
 	} 
 	else {
 		req->status = SOUP_STATUS_FINISHED;
-		req->priv->read_tag = 0;
+		req->priv->read_tag = NULL;
 	}
 
 	soup_message_run_handlers (req, SOUP_HANDLER_POST_BODY);
@@ -462,7 +464,8 @@
 {
 	SoupMessage *req = user_data;
 
-	req->priv->write_tag = 0;
+	soup_transfer_write_unref (req->priv->write_tag);
+	req->priv->write_tag = NULL;
 	req->status = SOUP_STATUS_READING_RESPONSE;
 }
 
Index: libsoup/soup-transfer.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-transfer.c,v
retrieving revision 1.32
diff -u -r1.32 soup-transfer.c
--- libsoup/soup-transfer.c	17 Jun 2003 12:24:12 -0000	1.32
+++ libsoup/soup-transfer.c	19 Jun 2003 15:52:59 -0000
@@ -186,9 +186,11 @@
 
 	r->callback_issued = TRUE;
 
+	soup_transfer_read_ref (r);
 	soup_transfer_read_stop (r);
 
 	(*r->read_done_cb) (&buf, r->user_data);
+	soup_transfer_read_unref (r);
 }
 
 static gboolean
@@ -775,8 +777,10 @@
 		goto WRITE_AGAIN;
 	}
 
+	soup_transfer_write_ref (w);
 	soup_transfer_write_stop (w);
 	(*w->write_done_cb) (w->user_data);
+	soup_transfer_write_unref (w);
 	return FALSE;
 }
 


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