[ekiga] Fixed bug #708077 (don't use boost::signals2::trackable)



commit 6f9110430c3d5381221f49642bfb252557e2b35f
Author: Julien Puydt <jpuydt free fr>
Date:   Sat Mar 1 21:05:42 2014 +0100

    Fixed bug #708077 (don't use boost::signals2::trackable)

 lib/engine/account/bank-impl.h                     |    1 -
 lib/engine/chat/dialect-impl.h                     |    3 +--
 .../components/call-history/history-book.cpp       |    4 ++--
 lib/engine/components/call-history/history-book.h  |    6 ++++--
 .../components/call-history/history-contact.h      |    3 +--
 .../components/local-roster/local-cluster.cpp      |    4 ++--
 lib/engine/components/local-roster/local-cluster.h |    6 ++++--
 lib/engine/components/opal/opal-call.h             |    3 +--
 lib/engine/framework/scoped-connections.h          |    4 +++-
 lib/engine/presence/uri-presentity.h               |    3 +--
 lib/engine/protocol/call-core.h                    |    3 +--
 plugins/avahi/avahi-cluster.h                      |    3 +--
 plugins/avahi/avahi-heap.h                         |    3 +--
 plugins/libnotify/libnotify-main.cpp               |   17 +++++++++--------
 plugins/loudmouth/loudmouth-heap-roster.cpp        |    3 ++-
 plugins/loudmouth/loudmouth-heap-roster.h          |    5 +++--
 16 files changed, 36 insertions(+), 35 deletions(-)
---
diff --git a/lib/engine/account/bank-impl.h b/lib/engine/account/bank-impl.h
index 52c917a..5e10594 100644
--- a/lib/engine/account/bank-impl.h
+++ b/lib/engine/account/bank-impl.h
@@ -74,7 +74,6 @@ namespace Ekiga
   template<class AccountType = Account>
   class BankImpl:
     public Bank,
-    public boost::signals2::trackable,
     protected RefLister<AccountType>
   {
 
diff --git a/lib/engine/chat/dialect-impl.h b/lib/engine/chat/dialect-impl.h
index 74b6da2..0902854 100644
--- a/lib/engine/chat/dialect-impl.h
+++ b/lib/engine/chat/dialect-impl.h
@@ -45,8 +45,7 @@ namespace Ekiga
   template<typename ConversationType = Conversation>
   class DialectImpl:
     public Dialect,
-    public RefLister<ConversationType>,
-    public boost::signals2::trackable
+    public RefLister<ConversationType>
   {
   public:
 
diff --git a/lib/engine/components/call-history/history-book.cpp 
b/lib/engine/components/call-history/history-book.cpp
index dedbbcd..80b4044 100644
--- a/lib/engine/components/call-history/history-book.cpp
+++ b/lib/engine/components/call-history/history-book.cpp
@@ -78,8 +78,8 @@ History::Book::Book (Ekiga::ServiceCore& core):
 
   boost::shared_ptr<Ekiga::CallCore> call_core = core.get<Ekiga::CallCore> ("call-core");
 
-  call_core->missed_call.connect (boost::bind (&History::Book::on_missed_call, this, _1, _2));
-  call_core->cleared_call.connect (boost::bind (&History::Book::on_cleared_call, this, _1, _2, _3));
+  connections.add (call_core->missed_call.connect (boost::bind (&History::Book::on_missed_call, this, _1, 
_2)));
+  connections.add (call_core->cleared_call.connect (boost::bind (&History::Book::on_cleared_call, this, _1, 
_2, _3)));
 
   enforce_size_limit ();
 }
diff --git a/lib/engine/components/call-history/history-book.h 
b/lib/engine/components/call-history/history-book.h
index fce8c3f..1ca6340 100644
--- a/lib/engine/components/call-history/history-book.h
+++ b/lib/engine/components/call-history/history-book.h
@@ -43,6 +43,7 @@
 #include "history-contact.h"
 
 #include "ekiga-settings.h"
+#include "scoped-connections.h"
 
 namespace History
 {
@@ -54,8 +55,7 @@ namespace History
  */
 
   class Book:
-    public Ekiga::Book,
-    public boost::signals2::trackable
+    public Ekiga::Book
   {
   public:
 
@@ -92,6 +92,8 @@ namespace History
 
   private:
 
+    Ekiga::scoped_connections connections;
+
     void parse_entry (xmlNodePtr entry);
 
     void save () const;
diff --git a/lib/engine/components/call-history/history-contact.h 
b/lib/engine/components/call-history/history-contact.h
index e436aa8..443c34f 100644
--- a/lib/engine/components/call-history/history-contact.h
+++ b/lib/engine/components/call-history/history-contact.h
@@ -60,8 +60,7 @@ namespace History
   } call_type;
 
   class Contact:
-    public Ekiga::Contact,
-    public boost::signals2::trackable
+    public Ekiga::Contact
   {
   public:
 
diff --git a/lib/engine/components/local-roster/local-cluster.cpp 
b/lib/engine/components/local-roster/local-cluster.cpp
index 188d236..bed47f0 100644
--- a/lib/engine/components/local-roster/local-cluster.cpp
+++ b/lib/engine/components/local-roster/local-cluster.cpp
@@ -86,8 +86,8 @@ Local::Cluster::set_heap (HeapPtr _heap)
   boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
   if (pcore) {
 
-    pcore->presence_received.connect (boost::bind (&Local::Cluster::on_presence_received, this, _1, _2));
-    pcore->status_received.connect (boost::bind (&Local::Cluster::on_status_received, this, _1, _2));
+    connections.add (pcore->presence_received.connect (boost::bind (&Local::Cluster::on_presence_received, 
this, _1, _2)));
+    connections.add (pcore->status_received.connect (boost::bind (&Local::Cluster::on_status_received, this, 
_1, _2)));
   }
 }
 
diff --git a/lib/engine/components/local-roster/local-cluster.h 
b/lib/engine/components/local-roster/local-cluster.h
index 18bf2bd..5bda32f 100644
--- a/lib/engine/components/local-roster/local-cluster.h
+++ b/lib/engine/components/local-roster/local-cluster.h
@@ -39,6 +39,7 @@
 #include "cluster-impl.h"
 #include "trigger.h"
 #include "local-heap.h"
+#include "scoped-connections.h"
 
 namespace Local
 {
@@ -50,8 +51,7 @@ namespace Local
 
   class Cluster :
     public Ekiga::ClusterImpl<Heap>,
-    public Ekiga::Trigger,
-    public boost::signals2::trackable
+    public Ekiga::Trigger
   {
   public:
 
@@ -81,6 +81,8 @@ namespace Local
 
   private:
 
+    Ekiga::scoped_connections connections;
+
     boost::weak_ptr<Ekiga::PresenceCore> presence_core;
     HeapPtr heap;
 
diff --git a/lib/engine/components/opal/opal-call.h b/lib/engine/components/opal/opal-call.h
index 6968419..3c4c8f0 100644
--- a/lib/engine/components/opal/opal-call.h
+++ b/lib/engine/components/opal/opal-call.h
@@ -56,8 +56,7 @@ namespace Opal {
   class CallManager;
   class Call
     : public OpalCall,
-      public Ekiga::Call,
-      public boost::signals2::trackable
+      public Ekiga::Call
   {
 
 public:
diff --git a/lib/engine/framework/scoped-connections.h b/lib/engine/framework/scoped-connections.h
index 7b2fcaa..8001019 100644
--- a/lib/engine/framework/scoped-connections.h
+++ b/lib/engine/framework/scoped-connections.h
@@ -43,7 +43,9 @@
 /* The boost signals2 library has several tricks to disconnect connections on signals
  * automatically, namely :
  * - inherit from boost::signals2::trackable, which is good to get rid of
- * connnections to a dying object ;
+ * connnections to a dying object (but that basically means you are lazy
+ * so it's probably better to avoid that method, as that means we might
+ * end up with memory problems later on) ;
  * - use a boost::signals2::scoped_connection which makes it possible to do things
  * more manually, but is annoying when you need many of them because they're not
  * easy to put in a container ;
diff --git a/lib/engine/presence/uri-presentity.h b/lib/engine/presence/uri-presentity.h
index ffe4b56..1076bc7 100644
--- a/lib/engine/presence/uri-presentity.h
+++ b/lib/engine/presence/uri-presentity.h
@@ -60,8 +60,7 @@ namespace Ekiga
    * This class implements an Ekiga::Presentity.
    */
   class URIPresentity:
-    public Ekiga::Presentity,
-    public boost::signals2::trackable
+    public Ekiga::Presentity
   {
   public:
 
diff --git a/lib/engine/protocol/call-core.h b/lib/engine/protocol/call-core.h
index cb4a987..8f38f9c 100644
--- a/lib/engine/protocol/call-core.h
+++ b/lib/engine/protocol/call-core.h
@@ -63,8 +63,7 @@ namespace Ekiga
   class CallManager;
 
   class CallCore:
-    public Service,
-    public boost::signals2::trackable
+    public Service
     {
 
   public:
diff --git a/plugins/avahi/avahi-cluster.h b/plugins/avahi/avahi-cluster.h
index 1821553..b20b7db 100644
--- a/plugins/avahi/avahi-cluster.h
+++ b/plugins/avahi/avahi-cluster.h
@@ -52,8 +52,7 @@ namespace Avahi
 
   class Cluster:
     public Ekiga::Service,
-    public Ekiga::ClusterImpl<Heap>,
-    public boost::signals2::trackable
+    public Ekiga::ClusterImpl<Heap>
   {
   public:
 
diff --git a/plugins/avahi/avahi-heap.h b/plugins/avahi/avahi-heap.h
index 6449c2b..a03c99e 100644
--- a/plugins/avahi/avahi-heap.h
+++ b/plugins/avahi/avahi-heap.h
@@ -59,8 +59,7 @@ namespace Avahi
 
   class Heap:
     public Ekiga::PresenceFetcher,
-    public Ekiga::HeapImpl<Ekiga::URIPresentity>,
-    public boost::signals2::trackable
+    public Ekiga::HeapImpl<Ekiga::URIPresentity>
   {
   public:
 
diff --git a/plugins/libnotify/libnotify-main.cpp b/plugins/libnotify/libnotify-main.cpp
index 33ef931..c3ef174 100644
--- a/plugins/libnotify/libnotify-main.cpp
+++ b/plugins/libnotify/libnotify-main.cpp
@@ -47,11 +47,10 @@
 #include "kickstart.h"
 #include "notification-core.h"
 #include "call-core.h"
-
+#include "scoped-connections.h"
 
 class LibNotify:
-  public Ekiga::Service,
-  public boost::signals2::trackable
+  public Ekiga::Service
 {
 public:
 
@@ -69,6 +68,8 @@ public:
 
 private:
 
+  Ekiga::scoped_connections connections;
+
   bool has_actions;
 
   void on_notification_added (boost::shared_ptr<Ekiga::Notification> notif);
@@ -179,10 +180,10 @@ LibNotify::LibNotify (Ekiga::ServiceCore& core)
     g_list_free (capabilities);
   }
   /* Notifications coming from various components */
-  notification_core->notification_added.connect (boost::bind (&LibNotify::on_notification_added, this, _1));
+  connections.append (notification_core->notification_added.connect (boost::bind 
(&LibNotify::on_notification_added, this, _1)));
 
   /* Specific notifications */
-  call_core->setup_call.connect (boost::bind (&LibNotify::on_call_notification, this, _1, _2));
+  connections.append (call_core->setup_call.connect (boost::bind (&LibNotify::on_call_notification, this, 
_1, _2)));
 }
 
 LibNotify::~LibNotify ()
@@ -289,9 +290,9 @@ LibNotify::on_call_notification (boost::shared_ptr<Ekiga::CallManager> manager,
   notify_notification_set_timeout (notify, NOTIFY_EXPIRES_NEVER);
   notify_notification_set_urgency (notify, NOTIFY_URGENCY_CRITICAL);
 
-  call->established.connect (boost::bind (&LibNotify::on_call_notification_closed, this, (gpointer) notify));
-  call->missed.connect (boost::bind (&LibNotify::on_call_notification_closed, this, (gpointer) notify));
-  call->cleared.connect (boost::bind (&LibNotify::on_call_notification_closed, this, (gpointer) notify));
+  connections.append (call->established.connect (boost::bind (&LibNotify::on_call_notification_closed, this, 
(gpointer) notify)));
+  connections.append (call->missed.connect (boost::bind (&LibNotify::on_call_notification_closed, this, 
(gpointer) notify)));
+  connections.append (call->cleared.connect (boost::bind (&LibNotify::on_call_notification_closed, this, 
(gpointer) notify)));
 
   notify_notification_show (notify, NULL);
 
diff --git a/plugins/loudmouth/loudmouth-heap-roster.cpp b/plugins/loudmouth/loudmouth-heap-roster.cpp
index b05eb1c..68bce15 100644
--- a/plugins/loudmouth/loudmouth-heap-roster.cpp
+++ b/plugins/loudmouth/loudmouth-heap-roster.cpp
@@ -46,11 +46,12 @@ LM::HeapRoster::HeapRoster (boost::shared_ptr<Ekiga::PersonalDetails> details_,
                            DialectPtr dialect_):
   details(details_), dialect(dialect_)
 {
-  details->updated.connect (boost::bind (&LM::HeapRoster::on_personal_details_updated, this));
+  details_connection = details->updated.connect (boost::bind (&LM::HeapRoster::on_personal_details_updated, 
this));
 }
 
 LM::HeapRoster::~HeapRoster ()
 {
+  details_connection.disconnect ();
 }
 
 const std::string
diff --git a/plugins/loudmouth/loudmouth-heap-roster.h b/plugins/loudmouth/loudmouth-heap-roster.h
index 1fee4f5..1aa5cbb 100644
--- a/plugins/loudmouth/loudmouth-heap-roster.h
+++ b/plugins/loudmouth/loudmouth-heap-roster.h
@@ -45,8 +45,7 @@ namespace LM
 {
   class HeapRoster:
     public Ekiga::HeapImpl<Presentity>,
-    public LM::Handler,
-    public boost::signals2::trackable
+    public LM::Handler
   {
   public:
 
@@ -85,6 +84,8 @@ namespace LM
 
   private:
 
+    boost::signals2::connection details_connection;
+
     boost::shared_ptr<Ekiga::PersonalDetails> details;
 
     DialectPtr dialect;


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