[libgdata/libgdata-0-5: 6/8] Bug 602156 — GDataUploadStream should close GOutputStream on dispose



commit 4ff140c5d7b7d1a800e6908d87e0a898fab4a194
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Nov 17 12:46:39 2009 +0000

    Bug 602156 â?? GDataUploadStream should close GOutputStream on dispose
    
    Close the GOutputStream before disposing private data for
    GDataUploadStream which could be referenced by threaded code called when
    the upload is cancelled. Closes: bgo#602156

 gdata/gdata-upload-stream.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index 0f78649..b432fc0 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -210,6 +210,11 @@ gdata_upload_stream_dispose (GObject *object)
 {
 	GDataUploadStreamPrivate *priv = GDATA_UPLOAD_STREAM_GET_PRIVATE (object);
 
+	/* Close the stream before unreffing things like priv->service, which stops crashes like bgo#602156 if the stream is unreffed in the middle
+	 * of network operations */
+	if (g_output_stream_is_closed (G_OUTPUT_STREAM (object)) == FALSE)
+		g_output_stream_close (G_OUTPUT_STREAM (object), NULL, NULL);
+
 	if (priv->service != NULL)
 		g_object_unref (priv->service);
 	priv->service = NULL;



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