[ekiga] Made the Ekiga::ServiceCore debug output more fault tolerant



commit e4c675d5fc227f60a87facaa1e7093a5bd68be3b
Author: Julien Puydt <jpuydt free fr>
Date:   Wed Jan 23 20:39:30 2013 +0100

    Made the Ekiga::ServiceCore debug output more fault tolerant
    
    It was crashing for an unknown reason (but I'm suspecting threads, for
    what else can make code using boost smart pointers crashy?).

 lib/engine/framework/services.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/lib/engine/framework/services.cpp b/lib/engine/framework/services.cpp
index 130bdd0..9a98c43 100644
--- a/lib/engine/framework/services.cpp
+++ b/lib/engine/framework/services.cpp
@@ -77,11 +77,11 @@ Ekiga::ServiceCore::ServiceCore (): closed(false)
 Ekiga::ServiceCore::~ServiceCore ()
 {
 #if DEBUG
-  std::list<boost::weak_ptr<Service> > remaining_services;
+  std::map<std::string, boost::weak_ptr<Service> > remaining_services;
   for (std::list<boost::shared_ptr<Service> >::iterator iter = services.begin();
        iter != services.end ();
        ++iter)
-    remaining_services.push_front (*iter);
+    remaining_services[(*iter)->get_name ()] = *iter;
 #endif
   /* this frees the memory, if we're the only to hold references,
    * and frees the last first -- so there's no problem
@@ -90,15 +90,15 @@ Ekiga::ServiceCore::~ServiceCore ()
     services.pop_front ();
 
 #if DEBUG
-  for (std::list<boost::weak_ptr<Service> >::iterator iter = remaining_services.begin();
+  for (std::map<std::string, boost::weak_ptr<Service> >::iterator iter = remaining_services.begin();
        iter != remaining_services.end ();
        ++iter) {
 
-    ServicePtr service = iter->lock();
+    ServicePtr service = iter->second.lock();
     if (service) {
 
       std::cout << "Ekiga::ServiceCore: "
-		<< service->get_name()
+		<< iter->first
 		<< " hasn't been freed correctly!"
 		<< " (with "
 		<< service.use_count() - 1



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