[ekiga] Add comments to warn about importance of slot ordering in removed signal



commit eed5d837f3715e4f64475a015732f8165fc5f7d6
Author: Eugen Dedu <eugen dedu univ-fcomte fr>
Date:   Tue Dec 1 15:32:05 2015 +0100

    Add comments to warn about importance of slot ordering in removed signal

 lib/engine/components/opal/opal-account.cpp |    6 +++---
 lib/engine/components/opal/opal-bank.cpp    |    2 +-
 lib/engine/framework/dynamic-object-store.h |    3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 7d21d86..ce3ca60 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -972,7 +972,7 @@ Opal::Account::load_presentity (boost::weak_ptr<Ekiga::PresenceCore> _presence_c
   // When the presentity emits trigger_saving, we relay it "upstream" so that the
   // Bank can save everything.
   presentities.add_connection (pres, pres->trigger_saving.connect (boost::ref (trigger_saving)));
-  presentities.add_connection (pres, pres->removed.connect (boost::bind (&Opal::Account::unfetch, this, 
pres->get_uri ()), boost::signals2::at_front));
+  presentities.add_connection (pres, pres->removed.connect (boost::bind (&Opal::Account::unfetch, this, 
pres->get_uri ()), boost::signals2::at_front));  // slot from DynamicObjectStore must be the last called
   presentities.add_connection (pres, pres->updated.connect (boost::bind (&Opal::Account::fetch, this, 
pres->get_uri ())));
   add_presentity (pres);
 
@@ -1178,8 +1178,8 @@ Opal::Account::OnPresenceChange (OpalPresentity& /*presentity*/,
     if (info->m_infoData.Find("closed") != P_MAX_INDEX)
       new_presence = "offline";
     else
-    // do not change presence
-    return;
+      // do not change presence
+      return;
     break;
   case OpalPresenceInfo::Available:
     new_presence = "available";
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index deb41be..2ded6c5 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -115,7 +115,7 @@ Opal::Bank::load_account (boost::function0<std::list<std::string> > _existing_gr
                            _node);
 
   accounts.add_connection (account, account->trigger_saving.connect (boost::bind (&Opal::Bank::save, this)));
-  accounts.add_connection (account, account->removed.connect (boost::bind (&Opal::Bank::on_account_removed, 
this, _1), boost::signals2::at_front));
+  accounts.add_connection (account, account->removed.connect (boost::bind (&Opal::Bank::on_account_removed, 
this, _1), boost::signals2::at_front));  // slot from DynamicObjectStore must be the last called
 
   add_account (account);
   add_heap (account);
diff --git a/lib/engine/framework/dynamic-object-store.h b/lib/engine/framework/dynamic-object-store.h
index 21c0e04..10bd22f 100644
--- a/lib/engine/framework/dynamic-object-store.h
+++ b/lib/engine/framework/dynamic-object-store.h
@@ -117,6 +117,9 @@ Ekiga::DynamicObjectStore<ObjectType>::add_object (boost::shared_ptr<ObjectType>
     object_added (obj);
 
     objects[obj]->add (obj->updated.connect (boost::bind (boost::ref (object_updated), _1)));
+    // this must be the last slot to execute
+    // the other slots connecting to removed signal must add at_front parameter
+    // in boost signals2 it is not possible to specify a slot to be executed last when the following slots 
are added without parameter
     objects[obj]->add (obj->removed.connect (boost::bind 
(&Ekiga::DynamicObjectStore<ObjectType>::remove_object, this, _1)));
   }
 }


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