[libgdata] Revert "core: Write upload chunks in an idle handler to avoid stack overflow"



commit 2cdc8344b34c867f1f0b259413807b34c297508d
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Jul 31 11:18:00 2013 +0200

    Revert "core: Write upload chunks in an idle handler to avoid stack overflow"
    
    This reverts commit e795f559327b3f208d768a4461ca1829e0f44693.
    
    This fixes GDataUploadStream now that we use SoupSession rather than
    SoupSessionSync. See the discussion in bug #703464 for more details; we need
    to append body chunks before returning from the wrote-body-data signal
    handler in order to not stall the upload and hit an assertion.
    
    See: https://bugzilla.gnome.org/show_bug.cgi?id=703464

 gdata/gdata-upload-stream.c |   30 ++----------------------------
 1 files changed, 2 insertions(+), 28 deletions(-)
---
diff --git a/gdata/gdata-upload-stream.c b/gdata/gdata-upload-stream.c
index 2430641..5043e0f 100644
--- a/gdata/gdata-upload-stream.c
+++ b/gdata/gdata-upload-stream.c
@@ -1075,32 +1075,10 @@ wrote_headers_cb (SoupMessage *message, GDataUploadStream *self)
        write_next_chunk (self, message);
 }
 
-typedef struct {
-       GDataUploadStream *upload_stream;
-       SoupMessage *message;
-} WriteNextChunkData;
-
-static void
-write_next_chunk_data_free (WriteNextChunkData *data)
-{
-       g_object_unref (data->message);
-       g_object_unref (data->upload_stream);
-       g_slice_free (WriteNextChunkData, data);
-}
-
-static gboolean
-write_next_chunk_cb (gpointer user_data)
-{
-       WriteNextChunkData *data = user_data;
-       write_next_chunk (data->upload_stream, data->message);
-       return FALSE;
-}
-
 static void
 wrote_body_data_cb (SoupMessage *message, SoupBuffer *buffer, GDataUploadStream *self)
 {
        GDataUploadStreamPrivate *priv = self->priv;
-       WriteNextChunkData *data;
 
        /* Signal the main thread that the chunk has been written */
        g_mutex_lock (&(priv->write_mutex));
@@ -1115,12 +1093,8 @@ wrote_body_data_cb (SoupMessage *message, SoupBuffer *buffer, GDataUploadStream
        g_cond_signal (&(priv->write_cond));
        g_mutex_unlock (&(priv->write_mutex));
 
-       /* Send the next chunk to libsoup. Do so in an idle callback to avoid overflowing the stack. */
-       data = g_slice_new (WriteNextChunkData);
-       data->message = g_object_ref (message);
-       data->upload_stream = g_object_ref (self);
-
-       g_idle_add_full (G_PRIORITY_DEFAULT, write_next_chunk_cb, data, (GDestroyNotify) 
write_next_chunk_data_free);
+       /* Send the next chunk to libsoup */
+       write_next_chunk (self, message);
 }
 
 static gpointer


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