[ekiga] Made the SIP::Dialect class retain only a weak reference to the Ekiga::PresenceCore



commit 5893957bf7c6275902f3f8be755ba3816a423121
Author: Julien Puydt <jpuydt free fr>
Date:   Sun Feb 16 18:01:35 2014 +0100

    Made the SIP::Dialect class retain only a weak reference to the Ekiga::PresenceCore

 lib/engine/components/opal/sip-dialect.cpp |    5 +++--
 lib/engine/components/opal/sip-dialect.h   |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/lib/engine/components/opal/sip-dialect.cpp b/lib/engine/components/opal/sip-dialect.cpp
index 6566100..51bdac4 100644
--- a/lib/engine/components/opal/sip-dialect.cpp
+++ b/lib/engine/components/opal/sip-dialect.cpp
@@ -82,6 +82,7 @@ SIP::Dialect::open_chat_with (std::string uri,
 {
   ConversationPtr result;
   std::string display_name = name;
+  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
 
   for (iterator iter = begin ();
        iter != end ();
@@ -89,10 +90,10 @@ SIP::Dialect::open_chat_with (std::string uri,
     if ((*iter)->get_uri () == uri)
       result = *iter;
 
-  if ( !result) {
+  if ( !result && pcore) {
 
     // FIXME: here find a better display_name
-    result = ConversationPtr (new Conversation(presence_core,
+    result = ConversationPtr (new Conversation(pcore,
                                               uri,
                                               display_name,
                                               boost::bind(sender, uri, _1)));
diff --git a/lib/engine/components/opal/sip-dialect.h b/lib/engine/components/opal/sip-dialect.h
index 2e94dd5..b016303 100644
--- a/lib/engine/components/opal/sip-dialect.h
+++ b/lib/engine/components/opal/sip-dialect.h
@@ -62,7 +62,7 @@ namespace SIP
                          std::string name);
 
   private:
-    boost::shared_ptr<Ekiga::PresenceCore> presence_core;
+    boost::weak_ptr<Ekiga::PresenceCore> presence_core;
     boost::function2<bool, std::string, Ekiga::Message::payload_type> sender;
 
     ConversationPtr open_chat_with (std::string uri,


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