[ekiga] Fixed a theoretical crash in the Ekiga::URIPresentity class



commit 75af62f71a0d575dcda9102779f058098ec9ff6b
Author: Julien Puydt <jpuydt free fr>
Date:   Sat Mar 1 14:20:24 2014 +0100

    Fixed a theoretical crash in the Ekiga::URIPresentity class

 lib/engine/presence/uri-presentity.cpp |   10 ++++++++--
 lib/engine/presence/uri-presentity.h   |    2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/lib/engine/presence/uri-presentity.cpp b/lib/engine/presence/uri-presentity.cpp
index a80a7b1..12f874e 100644
--- a/lib/engine/presence/uri-presentity.cpp
+++ b/lib/engine/presence/uri-presentity.cpp
@@ -51,8 +51,14 @@ Ekiga::URIPresentity::URIPresentity (boost::shared_ptr<Ekiga::PresenceCore> pcor
                                     std::set<std::string> groups_):
   presence_core(pcore), name(name_), uri(uri_), presence("unknown"), groups(groups_)
 {
-  pcore->presence_received.connect (boost::bind (&Ekiga::URIPresentity::on_presence_received, this, _1, _2));
-  pcore->status_received.connect (boost::bind (&Ekiga::URIPresentity::on_status_received, this, _1, _2));
+  boost::signals2::connection conn;
+
+  conn = pcore->presence_received.connect (boost::bind (&Ekiga::URIPresentity::on_presence_received, this, 
_1, _2));
+  connections.add (conn);
+
+  conn = pcore->status_received.connect (boost::bind (&Ekiga::URIPresentity::on_status_received, this, _1, 
_2));
+  connections.add (conn);
+
   pcore->fetch_presence (uri);
 }
 
diff --git a/lib/engine/presence/uri-presentity.h b/lib/engine/presence/uri-presentity.h
index 6434c23..ffe4b56 100644
--- a/lib/engine/presence/uri-presentity.h
+++ b/lib/engine/presence/uri-presentity.h
@@ -41,6 +41,7 @@
 #include "form.h"
 #include "presence-core.h"
 #include "presentity.h"
+#include "scoped-connections.h"
 
 /* The basic use-case is when one has only an uri (and a name), but not much
  * data, and the presence core is supposed to take care of making it live.
@@ -98,6 +99,7 @@ namespace Ekiga
   private:
 
     boost::weak_ptr<Ekiga::PresenceCore> presence_core;
+    Ekiga::scoped_connections connections;
 
     std::string name;
     std::string uri;


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