[ekiga] Opal: Explicitely remove the SIP&H323 managers we created when we are destructed.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Opal: Explicitely remove the SIP&H323 managers we created when we are destructed.
- Date: Sat, 24 Jan 2015 16:19:07 +0000 (UTC)
commit c19bdf6d1fb0c571512b0b2cfe16d4d6c8232138
Author: Damien Sandras <dsandras seconix com>
Date: Sat Jan 24 16:37:39 2015 +0100
Opal: Explicitely remove the SIP&H323 managers we created when we are destructed.
lib/engine/components/opal/opal-call-manager.cpp | 11 ++++++-----
lib/engine/components/opal/opal-call-manager.h | 4 ++++
lib/engine/protocol/call-manager.cpp | 7 +++++++
lib/engine/protocol/call-manager.h | 10 ++++++++++
4 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-call-manager.cpp
b/lib/engine/components/opal/opal-call-manager.cpp
index 66e953b..27a2acc 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -212,13 +212,11 @@ CallManager::CallManager (Ekiga::ServiceCore& core)
pcssEP->SetSoundChannelPlayDevice("EKIGA");
pcssEP->SetSoundChannelRecordDevice("EKIGA");
- boost::shared_ptr<Sip::EndPoint> sip_endpoint (new Sip::EndPoint (*this, core),
- null_deleter ());
+ sip_endpoint = boost::shared_ptr<Sip::EndPoint> (new Sip::EndPoint (*this, core), null_deleter ());
add_protocol_manager (sip_endpoint);
#ifdef HAVE_H323
- boost::shared_ptr<H323::EndPoint> h323_endpoint (new H323::EndPoint (*this, core),
- null_deleter ());
+ h323_endpoint= boost::shared_ptr<H323::EndPoint>(new H323::EndPoint (*this, core), null_deleter ());
add_protocol_manager (h323_endpoint);
#endif
}
@@ -226,10 +224,13 @@ CallManager::CallManager (Ekiga::ServiceCore& core)
CallManager::~CallManager ()
{
+ remove_protocol_manager (sip_endpoint);
+#ifdef HAVE_H323
+ remove_protocol_manager (h323_endpoint);
+#endif
if (stun_thread)
stun_thread->WaitForTermination ();
ClearAllCalls (OpalConnection::EndedByLocalUser, true);
- ShutDownEndpoints ();
g_async_queue_unref (queue);
}
diff --git a/lib/engine/components/opal/opal-call-manager.h b/lib/engine/components/opal/opal-call-manager.h
index cacc2f9..e93e9da 100644
--- a/lib/engine/components/opal/opal-call-manager.h
+++ b/lib/engine/components/opal/opal-call-manager.h
@@ -229,6 +229,10 @@ private:
boost::shared_ptr<Ekiga::Settings> call_options_settings;
boost::shared_ptr<Ekiga::Settings> call_forwarding_settings;
boost::shared_ptr<Ekiga::Settings> personal_data_settings;
+ boost::shared_ptr<Sip::EndPoint> sip_endpoint;
+#ifdef HAVE_H323
+ boost::shared_ptr<H323::EndPoint> h323_endpoint;
+#endif
};
};
#endif
diff --git a/lib/engine/protocol/call-manager.cpp b/lib/engine/protocol/call-manager.cpp
index afa88c7..01d3912 100644
--- a/lib/engine/protocol/call-manager.cpp
+++ b/lib/engine/protocol/call-manager.cpp
@@ -50,6 +50,13 @@ void CallManager::add_protocol_manager (boost::shared_ptr<CallProtocolManager> m
}
+void CallManager::remove_protocol_manager (boost::shared_ptr<CallProtocolManager> manager)
+{
+ manager_removed (manager);
+ managers.erase (manager);
+}
+
+
boost::shared_ptr<CallProtocolManager> CallManager::get_protocol_manager (const std::string &protocol) const
{
for (CallManager::iterator iter = begin ();
diff --git a/lib/engine/protocol/call-manager.h b/lib/engine/protocol/call-manager.h
index f1a3197..f69caeb 100644
--- a/lib/engine/protocol/call-manager.h
+++ b/lib/engine/protocol/call-manager.h
@@ -77,6 +77,11 @@ namespace Ekiga
*/
void add_protocol_manager (boost::shared_ptr<CallProtocolManager> manager);
+ /** Remove a CallProtocolManager from the CallManager.
+ * @param The manager to be removed.
+ */
+ void remove_protocol_manager (boost::shared_ptr<CallProtocolManager> manager);
+
/** Return a pointer to a CallProtocolManager of the CallManager.
* @param protocol is the protcol name.
* @return a pointer to the CallProtocolManager or NULL if none.
@@ -100,6 +105,11 @@ namespace Ekiga
*/
boost::signals2::signal<void(boost::shared_ptr<CallProtocolManager>)> manager_added;
+ /** This signal is emitted when a Ekiga::CallProtocolManager has been
+ * removed from the CallManager.
+ */
+ boost::signals2::signal<void(boost::shared_ptr<CallProtocolManager>)> manager_removed;
+
/*
* CALL MANAGEMENT
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]