=?utf-8?q?=5Bfolks=5D_Bug_665728_=E2=80=94_prepare=28=29_isn=27t_mutually?= =?utf-8?q?_exclusive_inside_a_single_thread?=



commit 8bdeef859e7c094dbd5e2bbd6c918eb88dfb3044
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu Dec 8 14:54:29 2011 +0000

    Bug 665728 â prepare() isn't mutually exclusive inside a single thread
    
    Fix Tpf.PersonaStore.prepare() to only run once, even if it's called multiple
    times from the same thread (e.g. if the caller wasn't yielding on the async
    call returning).
    
    Closes: bgo#665728

 NEWS                                          |    2 ++
 backends/telepathy/lib/tpf-persona-store.vala |    6 +++++-
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index f1b6778..879c982 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Bugs fixed:
 * Bug 663889 â crash due to NameDetails which fail to guarantee
   non-null full-name/nickname
 * Bug 665039 â Crash in folks_backends_sw_backend_add_service
+* Bug 665728 â TpfPersonaStore: prepare() isn't mutually exclusive inside a
+  single thread
 
 Overview of changes from libfolks 0.6.4.1 to libfolks 0.6.5
 =============================================================
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index e3a49a1..567ec17 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -99,6 +99,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
   private MaybeBool _can_group_personas = MaybeBool.UNSET;
   private MaybeBool _can_remove_personas = MaybeBool.UNSET;
   private bool _is_prepared = false;
+  private bool _prepare_pending = false;
   private bool _is_quiescent = false;
   private bool _got_stored_channel_members = false;
   private bool _got_self_handle = false;
@@ -561,8 +562,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore
     {
       lock (this._is_prepared)
         {
-          if (!this._is_prepared)
+          if (!this._is_prepared && !this._prepare_pending)
             {
+              this._prepare_pending = true;
+
               this._account_manager = AccountManager.dup ();
 
               this._account_manager.account_removed.connect ((a) =>
@@ -626,6 +629,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
                 }
 
               this._is_prepared = true;
+              this._prepare_pending = false;
               this.notify_property ("is-prepared");
             }
         }



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