[folks] eds: Pass contact update notifications through idle queue



commit cbdde5cfaa1e36ddc7a99de7732146af9bb21e3b
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Mar 19 11:05:32 2015 +0000

    eds: Pass contact update notifications through idle queue
    
    This is a follow-up to commit e397d869d8f84641825252657aa34ae8487dd526.
    If the main context queue was non-empty, the idle callback from
    _contacts_changed_cb() would be queued for a while, whereas the callback
    in _commit_modified_property() would be executed immediately. This means
    _commit_modified_property() would finish yielding before the contact in
    question had been updated from EDS (the updated vCard would be sitting
    in the idle queue at this point), which is wrong.
    
    Fix that by queueing the callback in _commit_modified_property() in the
    idle queue, to keep it in order with the _contacts_changed_cb()
    callback.

 backends/eds/lib/edsf-persona-store.vala |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 83cdb14..2810882 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -1285,13 +1285,21 @@ public class Edsf.PersonaStore : Folks.PersonaStore
                           continue;
                         }
 
-                      /* Success! Return to _commit_modified_property(). */
-                      received_notification = true;
-
-                      if (has_yielded == true)
+                      /* Success! Return to _commit_modified_property(), but do
+                       * it via the idle queue so that the notification is
+                       * queued after the actual contact updates in
+                       * _contacts_changed_idle(). */
+                      this._idle_queue (() =>
                         {
-                          this._commit_modified_property.callback ();
-                        }
+                          received_notification = true;
+
+                          if (has_yielded == true)
+                            {
+                              this._commit_modified_property.callback ();
+                            }
+
+                          return false;
+                        });
 
                       return;
                     }


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