[libgdata] core: Fix idle callback priority for batch operation callbacks



commit 300c38f65e34d76649c39a050e7d5d792ffba68f
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Jul 2 12:59:28 2013 +0100

    core: Fix idle callback priority for batch operation callbacks
    
    Occasionally, the callback for an async batch operation as a whole was being
    called before the callbacks for the individual operations in the batch. This
    was causing the YouTube tests to spuriously fail every so often.
    
    Fix this by setting the callback priority for operation callbacks to be the
    same as that of the entire batch.

 gdata/gdata-batch-operation.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gdata/gdata-batch-operation.c b/gdata/gdata-batch-operation.c
index 1bb72c9..675473a 100644
--- a/gdata/gdata-batch-operation.c
+++ b/gdata/gdata-batch-operation.c
@@ -411,10 +411,13 @@ _gdata_batch_operation_run_callback (GDataBatchOperation *self, BatchOperation *
 
        /* Only dispatch it in the main thread if the request was run with *_run_async(). This allows 
applications to run batch operations entirely in
         * application-owned threads if desired. */
-       if (self->priv->is_async == TRUE)
-               g_idle_add ((GSourceFunc) run_callback_cb, op);
-       else
+       if (self->priv->is_async == TRUE) {
+               /* Send the callback; use G_PRIORITY_DEFAULT rather than G_PRIORITY_DEFAULT_IDLE
+                * to contend with the priorities used by the callback functions in GAsyncResult */
+               g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) run_callback_cb, op, NULL);
+       } else {
                run_callback_cb (op);
+       }
 }
 
 /* Free a #BatchOperation */


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