[ekiga/gnome-2-26] Fixed crash in avahi code by not using iterators (bug #577070)
- From: Eugen Dedu <ededu src gnome org>
- To: svn-commits-list gnome org
- Subject: [ekiga/gnome-2-26] Fixed crash in avahi code by not using iterators (bug #577070)
- Date: Mon, 27 Apr 2009 12:00:05 -0400 (EDT)
commit 45130b6fb270550c4c61258185648bbc3097f5ee
Author: Julien Puydt <jpuydt src gnome org>
Date: Sat Mar 28 20:09:14 2009 +0000
Fixed crash in avahi code by not using iterators (bug #577070)
svn path=/trunk/; revision=7828
---
lib/engine/components/avahi/avahi-heap.cpp | 25 ++++++++++++++++---------
lib/engine/components/avahi/avahi-heap.h | 3 +++
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/lib/engine/components/avahi/avahi-heap.cpp b/lib/engine/components/avahi/avahi-heap.cpp
index c39b79a..19c500e 100644
--- a/lib/engine/components/avahi/avahi-heap.cpp
+++ b/lib/engine/components/avahi/avahi-heap.cpp
@@ -190,7 +190,6 @@ Avahi::Heap::BrowserCallback (AvahiServiceBrowser *browser,
AvahiLookupResultFlags /*flags*/)
{
AvahiServiceResolver *resolver = NULL;
- bool found = false;
switch (event) {
@@ -207,14 +206,7 @@ Avahi::Heap::BrowserCallback (AvahiServiceBrowser *browser,
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 @@ Avahi::Heap::ResolverCallback (AvahiServiceResolver *resolver,
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;
+}
diff --git a/lib/engine/components/avahi/avahi-heap.h b/lib/engine/components/avahi/avahi-heap.h
index 3bc2811..76c1aa1 100644
--- a/lib/engine/components/avahi/avahi-heap.h
+++ b/lib/engine/components/avahi/avahi-heap.h
@@ -111,6 +111,9 @@ namespace Avahi
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]