ekiga r7828 - trunk/lib/engine/components/avahi



Author: jpuydt
Date: Sat Mar 28 20:09:14 2009
New Revision: 7828
URL: http://svn.gnome.org/viewvc/ekiga?rev=7828&view=rev

Log:
Fixed crash in avahi code by not using iterators (bug #577070)

Modified:
   trunk/lib/engine/components/avahi/avahi-heap.cpp
   trunk/lib/engine/components/avahi/avahi-heap.h

Modified: trunk/lib/engine/components/avahi/avahi-heap.cpp
==============================================================================
--- trunk/lib/engine/components/avahi/avahi-heap.cpp	(original)
+++ trunk/lib/engine/components/avahi/avahi-heap.cpp	Sat Mar 28 20:09:14 2009
@@ -190,7 +190,6 @@
 			      AvahiLookupResultFlags /*flags*/)
 {
   AvahiServiceResolver *resolver = NULL;
-  bool found = false;
 
   switch (event) {
 
@@ -207,14 +206,7 @@
     break;
 
   case AVAHI_BROWSER_REMOVE:
-    for (iterator iter = begin () ;
-	 !found && iter != end ();
-	 iter++)
-      if ((*iter)->get_name () == name) {
-
-	found = true;
-	(*iter)->removed.emit ();
-      }
+    visit_presentities (sigc::bind (sigc::mem_fun (this, &Avahi::Heap::remover), name));
     break;
   case AVAHI_BROWSER_CACHE_EXHAUSTED:
     // FIXME: do I care?
@@ -324,3 +316,18 @@
     break;
   }
 }
+
+bool
+Avahi::Heap::remover (Ekiga::PresentityPtr presentity,
+		      const std::string name)
+{
+  bool result = true;
+
+  if (presentity->get_name () == name) {
+
+    result = false;
+    presentity->removed.emit ();
+  }
+
+  return result;
+}

Modified: trunk/lib/engine/components/avahi/avahi-heap.h
==============================================================================
--- trunk/lib/engine/components/avahi/avahi-heap.h	(original)
+++ trunk/lib/engine/components/avahi/avahi-heap.h	Sat Mar 28 20:09:14 2009
@@ -111,6 +111,9 @@
     Ekiga::ServiceCore &core;
     AvahiGLibPoll *poll;
     AvahiClient *client;
+
+    bool remover (Ekiga::PresentityPtr presentity,
+		  const std::string name);
   };
 
   typedef gmref_ptr<Heap> HeapPtr;



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