[ekiga] Fix use of Ekiga::URIPresentity in the avahi plugin



commit 8bb51a468b6ae2afb68e685d7e64a95d86ff60b0
Author: Julien Puydt <jpuydt free fr>
Date:   Wed Jan 30 11:48:11 2013 +0100

    Fix use of Ekiga::URIPresentity in the avahi plugin
    
    Note to self: run grep from the toplevel to find all uses of a class...

 plugins/avahi/avahi-heap.cpp |    9 ++++++---
 plugins/avahi/avahi-heap.h   |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plugins/avahi/avahi-heap.cpp b/plugins/avahi/avahi-heap.cpp
index 01ec503..4401d66 100644
--- a/plugins/avahi/avahi-heap.cpp
+++ b/plugins/avahi/avahi-heap.cpp
@@ -88,11 +88,13 @@ avahi_resolver_callback (AvahiServiceResolver *resolver,
 }
 
 
-Avahi::Heap::Heap (Ekiga::ServiceCore &_core): core(_core)
+Avahi::Heap::Heap (Ekiga::ServiceCore& core)
 {
   const AvahiPoll *poll_api = NULL;
   int error;
 
+  presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
+
   /* let's make sure those are sanely initialized */
   poll = NULL;
   client = NULL;
@@ -368,13 +370,14 @@ Avahi::Heap::ResolverCallback (AvahiServiceResolver *resolver,
       /* ok, this is a new contact */
       gchar** broken = NULL;
       broken = g_strsplit_set (typ, "._", 0);
-      if (broken != NULL && broken[0] != NULL && broken[1] != NULL) {
+      boost::shared_ptr<Ekiga::PresenceCore> pcore = presence_core.lock ();
+      if (broken != NULL && broken[0] != NULL && broken[1] != NULL && pcore) {
 
 	std::set<std::string> groups;
 
 	groups.insert (_("Neighbours"));
 	url = g_strdup_printf ("%s:neighbour %s:%d", broken[1], host_name, port);
-	boost::shared_ptr<Ekiga::URIPresentity> presentity (new Ekiga::URIPresentity (core, name, url, groups));
+	boost::shared_ptr<Ekiga::URIPresentity> presentity (new Ekiga::URIPresentity (pcore, name, url, groups));
 	status_received (url, status);
 	presence_received (url, presence);
 	add_presentity (presentity);
diff --git a/plugins/avahi/avahi-heap.h b/plugins/avahi/avahi-heap.h
index dea9946..81e3944 100644
--- a/plugins/avahi/avahi-heap.h
+++ b/plugins/avahi/avahi-heap.h
@@ -108,7 +108,7 @@ namespace Avahi
 
   private:
 
-    Ekiga::ServiceCore &core;
+    boost::weak_ptr<Ekiga::PresenceCore> presence_core;
     AvahiGLibPoll *poll;
     AvahiClient *client;
 



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