[ekiga] Made it clearer that the assistant code cannot leak Ekiga::ServiceCore



commit 69ad1c45a4193a94a9b5d269997b9cd5ff4aee00
Author: Julien Puydt <jpuydt free fr>
Date:   Fri Jun 8 19:36:55 2012 +0200

    Made it clearer that the assistant code cannot leak Ekiga::ServiceCore

 src/ekiga.cpp         |    2 +-
 src/gui/assistant.cpp |   12 +++++-------
 src/gui/assistant.h   |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/ekiga.cpp b/src/ekiga.cpp
index f27f0ee..dd6dbcd 100644
--- a/src/ekiga.cpp
+++ b/src/ekiga.cpp
@@ -109,7 +109,7 @@ void GnomeMeeting::BuildGUI (Ekiga::ServiceCorePtr services)
 
   /* Build the GUI */
   gtk_window_set_default_icon_name (GM_ICON_LOGO);
-  assistant_window = ekiga_assistant_new (services.get ());
+  assistant_window = ekiga_assistant_new (*services);
   main_window = gm_main_window_new (*services);
   // FIXME should be moved in ekiga_assistant_new
   gtk_window_set_transient_for (GTK_WINDOW (assistant_window), GTK_WINDOW (main_window));
diff --git a/src/gui/assistant.cpp b/src/gui/assistant.cpp
index 1f05f8b..ccb5727 100644
--- a/src/gui/assistant.cpp
+++ b/src/gui/assistant.cpp
@@ -58,7 +58,6 @@ G_DEFINE_TYPE (EkigaAssistant, ekiga_assistant, GTK_TYPE_ASSISTANT);
 
 struct _EkigaAssistantPrivate
 {
-  Ekiga::ServiceCore *core;
   boost::shared_ptr<Ekiga::VideoInputCore> videoinput_core;
   boost::shared_ptr<Ekiga::AudioInputCore> audioinput_core;
   boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
@@ -1640,22 +1639,21 @@ ekiga_assistant_key_press_cb (GtkWidget *widget,
 
 
 GtkWidget *
-ekiga_assistant_new (Ekiga::ServiceCore *core)
+ekiga_assistant_new (Ekiga::ServiceCore& service_core)
 {
   EkigaAssistant *assistant;
 
   assistant = EKIGA_ASSISTANT (g_object_new (EKIGA_TYPE_ASSISTANT, NULL));
-  assistant->priv->core = core;
 
   /* FIXME: move this into the caller */
   g_signal_connect (assistant, "key-press-event",
                     G_CALLBACK (ekiga_assistant_key_press_cb), NULL);
 
   boost::signals::connection conn;
-  assistant->priv->videoinput_core = core->get<Ekiga::VideoInputCore> ("videoinput-core");
-  assistant->priv->audioinput_core = core->get<Ekiga::AudioInputCore> ("audioinput-core");
-  assistant->priv->audiooutput_core = core->get<Ekiga::AudioOutputCore> ("audiooutput-core");
-  assistant->priv->bank = core->get<Opal::Bank> ("opal-account-store");
+  assistant->priv->videoinput_core = service_core.get<Ekiga::VideoInputCore> ("videoinput-core");
+  assistant->priv->audioinput_core = service_core.get<Ekiga::AudioInputCore> ("audioinput-core");
+  assistant->priv->audiooutput_core = service_core.get<Ekiga::AudioOutputCore> ("audiooutput-core");
+  assistant->priv->bank = service_core.get<Opal::Bank> ("opal-account-store");
 
   conn = assistant->priv->videoinput_core->device_added.connect (boost::bind (&on_videoinput_device_added_cb, _1, _2, assistant));
   assistant->priv->connections.push_back (conn);
diff --git a/src/gui/assistant.h b/src/gui/assistant.h
index 9b60478..f850158 100644
--- a/src/gui/assistant.h
+++ b/src/gui/assistant.h
@@ -70,7 +70,7 @@ struct _EkigaAssistant {
 typedef GtkAssistantClass EkigaAssistantClass;
 
 GType        ekiga_assistant_get_type   ();
-GtkWidget   *ekiga_assistant_new        (Ekiga::ServiceCore *core);
+GtkWidget   *ekiga_assistant_new        (Ekiga::ServiceCore& core);
 
 G_END_DECLS
 



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