[ekiga/v4_0] Added the possibility for the Ekiga::ServiceCore to print the name of the objects which didn't get f



commit 9d11ea26f1b7aa778ba323e18f08e9447a195837
Author: Julien Puydt <jpuydt free fr>
Date:   Sun Jan 13 16:55:00 2013 +0100

    Added the possibility for the Ekiga::ServiceCore to print the name of the objects which didn't get freed

 lib/engine/framework/services.cpp |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/lib/engine/framework/services.cpp b/lib/engine/framework/services.cpp
index 87af7a7..25b6e66 100644
--- a/lib/engine/framework/services.cpp
+++ b/lib/engine/framework/services.cpp
@@ -71,11 +71,34 @@ Ekiga::Service::get_string_property (const std::string /*name*/) const
 
 Ekiga::ServiceCore::~ServiceCore ()
 {
+#if DEBUG
+  std::list<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);
+#endif
   /* this frees the memory, if we're the only to hold references,
    * and frees the last first -- so there's no problem
    */
   while ( !services.empty ())
     services.pop_front ();
+
+#if DEBUG
+  for (std::list<boost::weak_ptr<Service> >::iterator iter = remaining_services.begin();
+       iter != remaining_services.end ();
+       ++iter) {
+
+    ServicePtr service = iter->lock();
+    if (service) {
+
+      std::cout << "Ekiga::ServiceCore: "
+		<< service->get_name()
+		<< " hasn't been freed correctly!"
+		<< std::endl;
+    }
+  }
+#endif
 }
 
 bool



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