[ekiga] Made the opal account store only weak-reference the presence core



commit 6707c585d23487ba9afcce33c6fc2b7d91ac4605
Author: Julien Puydt <jpuydt free fr>
Date:   Fri Jan 25 14:38:27 2013 +0100

    Made the opal account store only weak-reference the presence core
    
    We're back to an ekiga where no service object is leaked!

 lib/engine/components/opal/opal-bank.cpp |   10 ++++++----
 lib/engine/components/opal/opal-bank.h   |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index c9251f4..42ae57e 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -65,7 +65,8 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core):
   opal_component(core.get<CallManager> ("opal-component"))
 {
   boost::shared_ptr<CallManager> opal = opal_component.lock ();
-  if (!opal)
+  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
+  if ( !(opal && pcore))
     return;
 
   GSList *accounts = gm_conf_get_string_list (PROTOCOLS_KEY "accounts_list");
@@ -78,7 +79,7 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core):
 #ifdef HAVE_H323
 						 h323_endpoint,
 #endif
-						 presence_core,
+						 pcore,
 						 notification_core,
 						 personal_details,
 						 audiooutput_core,
@@ -231,14 +232,15 @@ void Opal::Bank::add (Account::Type acc_type,
                       unsigned timeout)
 {
   boost::shared_ptr<CallManager> opal = opal_component.lock ();
-  if (!opal)
+  boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
+  if ( !(opal && pcore))
     return;
   AccountPtr account
     = AccountPtr(new Opal::Account (sip_endpoint,
 #ifdef HAVE_H323
 				    h323_endpoint,
 #endif
-				    presence_core,
+				    pcore,
 				    notification_core,
 				    personal_details,
 				    audiooutput_core,
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index e6de2d4..659da66 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -96,7 +96,7 @@ private:
 #ifdef HAVE_H323
     boost::shared_ptr<Opal::H323::EndPoint> h323_endpoint;
 #endif
-    boost::shared_ptr<Ekiga::PresenceCore> presence_core;
+    boost::weak_ptr<Ekiga::PresenceCore> presence_core;
     boost::shared_ptr<Ekiga::NotificationCore> notification_core;
     boost::shared_ptr<Ekiga::PersonalDetails> personal_details;
     boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;



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