[ekiga] Break the cycle of dependency bank -> call manager -> SIP endpoint -> bank in the opal code
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Break the cycle of dependency bank -> call manager -> SIP endpoint -> bank in the opal code
- Date: Wed, 6 Feb 2013 02:40:53 +0000 (UTC)
commit 5aeb89399f3f2a42d8d6f175e3d9ddadbb503a0c
Author: Julien Puydt <jpuydt free fr>
Date: Wed Feb 6 03:38:38 2013 +0100
Break the cycle of dependency bank -> call manager -> SIP endpoint -> bank in the opal code
lib/engine/components/opal/sip-endpoint.cpp | 28 +++++++++++++++++---------
lib/engine/components/opal/sip-endpoint.h | 2 +-
2 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 41dd77c..927a1a7 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -895,10 +895,14 @@ Opal::Sip::EndPoint::registration_event_in_main (const std::string aor,
Opal::Account::RegistrationState state,
const std::string msg)
{
- AccountPtr account = bank->find_account (aor);
+ boost::shared_ptr<Opal::Bank> bk = bank.lock ();
+ if (bk) {
- if (account)
- account->handle_registration_event (state, msg);
+ AccountPtr account = bk->find_account (aor);
+
+ if (account)
+ account->handle_registration_event (state, msg);
+ }
}
void
@@ -921,11 +925,13 @@ void
Opal::Sip::EndPoint::mwi_received_in_main (const std::string aor,
const std::string info)
{
- AccountPtr account = bank->find_account (aor);
+ boost::shared_ptr<Opal::Bank> bk = bank.lock ();
+ if (bk) {
- if (account) {
+ AccountPtr account = bk->find_account (aor);
- account->handle_message_waiting_information (info);
+ if (account)
+ account->handle_message_waiting_information (info);
}
}
@@ -933,9 +939,9 @@ void
Opal::Sip::EndPoint::update_bank (boost::shared_ptr<Opal::Bank> _bank)
{
bank = _bank;
- bank->account_added.connect (boost::bind (&Opal::Sip::EndPoint::account_added, this, _1));
- bank->account_updated.connect (boost::bind (&Opal::Sip::EndPoint::account_updated_or_removed, this, _1));
- bank->account_removed.connect (boost::bind (&Opal::Sip::EndPoint::account_updated_or_removed, this, _1));
+ _bank->account_added.connect (boost::bind (&Opal::Sip::EndPoint::account_added, this, _1));
+ _bank->account_updated.connect (boost::bind (&Opal::Sip::EndPoint::account_updated_or_removed, this, _1));
+ _bank->account_removed.connect (boost::bind (&Opal::Sip::EndPoint::account_updated_or_removed, this, _1));
account_updated_or_removed (Ekiga::AccountPtr ()/* unused*/);
}
@@ -953,7 +959,9 @@ Opal::Sip::EndPoint::account_updated_or_removed (Ekiga::AccountPtr /*account*/)
accounts.clear ();
}
{ // ... because here we call something which will want that very same mutex!
- bank->visit_accounts (boost::bind (&Opal::Sip::EndPoint::visit_account, this, _1));
+ boost::shared_ptr<Opal::Bank> bk = bank.lock ();
+ if (bk)
+ bk->visit_accounts (boost::bind (&Opal::Sip::EndPoint::visit_account, this, _1));
}
}
diff --git a/lib/engine/components/opal/sip-endpoint.h b/lib/engine/components/opal/sip-endpoint.h
index 0a26c0f..4790d1b 100644
--- a/lib/engine/components/opal/sip-endpoint.h
+++ b/lib/engine/components/opal/sip-endpoint.h
@@ -201,7 +201,7 @@ namespace Opal {
unsigned listen_port;
- boost::shared_ptr<Opal::Bank> bank;
+ boost::weak_ptr<Opal::Bank> bank;
boost::shared_ptr<SIP::Dialect> dialect;
};
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]