telepathy: Call continuations in idle callbacks rather than directly
authorPhilip Withnall <philip@tecnocode.co.uk>
Sun, 30 Dec 2012 22:41:59 +0000 (22:41 +0000)
committerPhilip Withnall <philip@tecnocode.co.uk>
Sun, 30 Dec 2012 22:45:55 +0000 (22:45 +0000)
The continuations will proceed to a g_simple_async_result_complete() call,
rather than a g_simple_async_result_complete_in_idle() call as I expected
(and didn’t check). This could result in the first continuation executing
a lot of code and starving the other continuations (and the original
prepare() call). By delaying the continuations to the idle queue, the
original prepare() call is guaranteed to finish first. Then the
continuations can only starve each other.

See: https://bugzilla.gnome.org/show_bug.cgi?id=677633

backends/telepathy/lib/tpf-logger.vala

index 2dccb67..c4f450b 100644 (file)
@@ -109,7 +109,7 @@ internal class Logger : GLib.Object
           /* Wake up any waiters. */
           foreach (unowned DelegateWrapper wrapper in Logger._prepare_waiters)
             {
-              wrapper.cb ();
+              Idle.add (wrapper.cb);
             }
 
           Logger._prepare_waiters = null;