[ekiga] Made the base Ekiga::ConfBridge class disconnect notifiers correctly



commit 6e84d65bf2f5fc5d8df6880d7688dfe7b474d70d
Author: Julien Puydt <jpuydt free fr>
Date:   Mon Jan 21 09:06:11 2013 +0100

    Made the base Ekiga::ConfBridge class disconnect notifiers correctly

 lib/engine/framework/gmconf-bridge.cpp |   25 ++++++++++++++-----------
 lib/engine/framework/gmconf-bridge.h   |    4 +++-
 2 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/lib/engine/framework/gmconf-bridge.cpp b/lib/engine/framework/gmconf-bridge.cpp
index dae1435..fd41667 100644
--- a/lib/engine/framework/gmconf-bridge.cpp
+++ b/lib/engine/framework/gmconf-bridge.cpp
@@ -40,14 +40,6 @@
 
 #include "gmconf.h"
 
-
-using namespace Ekiga;
-
-
-static void entry_changed_nt (gpointer /*id*/,
-                              GmConfEntry *entry, 
-                              gpointer data);
-
 static void 
 entry_changed_nt (gpointer /*id*/,
                   GmConfEntry *entry, 
@@ -59,14 +51,25 @@ entry_changed_nt (gpointer /*id*/,
   bridge->property_changed (key, entry);
 }
 
+Ekiga::ConfBridge::~ConfBridge()
+{
+  for (std::list<gpointer>::iterator iter = notifiers.begin ();
+       iter != notifiers.end ();
+       ++iter)
+    gm_conf_notifier_remove (*iter);
+}
 
-void ConfBridge::load (ConfKeys & keys)
+void
+Ekiga::ConfBridge::load (ConfKeys & keys)
 {
-  for (ConfKeys::iterator it = keys.begin ();
+  gpointer notifier = NULL;
+
+  for (Ekiga::ConfKeys::iterator it = keys.begin ();
        it != keys.end ();
        it++) {
 
-    gm_conf_notifier_add ((*it).c_str (), entry_changed_nt, this);
+    notifier = gm_conf_notifier_add ((*it).c_str (), entry_changed_nt, this);
+    notifiers.push_front (notifier);
     gm_conf_notifier_trigger ((*it).c_str ());
   }
 }
diff --git a/lib/engine/framework/gmconf-bridge.h b/lib/engine/framework/gmconf-bridge.h
index 8c9ee68..50e41ff 100644
--- a/lib/engine/framework/gmconf-bridge.h
+++ b/lib/engine/framework/gmconf-bridge.h
@@ -81,6 +81,7 @@ namespace Ekiga
        */
       ConfBridge (Ekiga::Service & _service) : service (_service) {};
 
+      ~ConfBridge ();
 
       /** Load notifiers for the vector of keys given as argument
        * @param keys is a vector of keys for which the ConfBridge will trigger 
@@ -96,7 +97,8 @@ namespace Ekiga
        */
       boost::signal2<void, std::string /*key*/, GmConfEntry * /*entry*/> property_changed;
 
-  protected :
+  protected:
+      std::list<gpointer> notifiers;
       Ekiga::Service & service;
     };
 };



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