[dconf] engine: accept out-of-order error reply messages



commit 0b7fe6e2ac16f5cf99bee68ce2c82b13d5ed4fce
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Jan 23 18:06:02 2013 -0500

    engine: accept out-of-order error reply messages
    
    Due to a quirk of the implementation of the D-Bus daemon (see upstream
    bug https://bugs.freedesktop.org/show_bug.cgi?id=59780 for details)
    error messages can arrive out of sequence with repsect to the order of
    the method calls that they are in reply to.
    
    This may or may not be a violation of the strict-ordering principle of
    D-Bus (which does not actually appear to be written into the spec) but
    either way, we should dial down our assumptions about ordering since the
    D-Bus implementation that everyone is using does not currently work this
    way.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687120

 engine/dconf-engine.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index 30c4881..5a7b6ac 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -878,7 +878,6 @@ dconf_engine_change_completed (DConfEngine  *engine,
                                const GError *error)
 {
   OutstandingChange *oc = handle;
-  DConfChangeset *expected;
 
   dconf_engine_lock_queues (engine);
 
@@ -888,9 +887,27 @@ dconf_engine_change_completed (DConfEngine  *engine,
    *
    * The reply we just received should therefore be at the head of
    * our 'in flight' queue.
+   *
+   * Due to https://bugs.freedesktop.org/show_bug.cgi?id=59780 it is
+   * possible that we receive an out-of-sequence error message, however,
+   * so only assume that messages are in-order for positive replies.
    */
-  expected = g_queue_pop_head (&engine->in_flight);
-  g_assert (expected && oc->change == expected);
+  if (reply)
+    {
+      DConfChangeset *expected;
+
+      expected = g_queue_pop_head (&engine->in_flight);
+      g_assert (expected && oc->change == expected);
+    }
+  else
+    {
+      gboolean found;
+
+      g_assert (error != NULL);
+
+      found = g_queue_remove (&engine->in_flight, oc->change);
+      g_assert (found);
+    }
 
   /* We just popped a change from the in-flight queue, possibly
    * making room for another to be added.  Check that.



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