[ekiga] Push the creation of the ServiceCore object in main
- From: Julien Puydt <jpuydt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [ekiga] Push the creation of the ServiceCore object in main
- Date: Tue, 13 Oct 2009 18:59:22 +0000 (UTC)
commit 44d3a2e5a239f40dbd71409510db8a463537a2bc
Author: Julien Puydt <jpuydt gnome org>
Date: Tue Oct 13 16:59:32 2009 +0200
Push the creation of the ServiceCore object in main
lib/engine/engine.cpp | 32 +++++++++++++++-----------------
lib/engine/engine.h | 3 ++-
src/ekiga.cpp | 5 +++--
src/ekiga.h | 3 ++-
src/gui/main.cpp | 4 +++-
5 files changed, 25 insertions(+), 22 deletions(-)
---
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 0777a46..1612ac9 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -102,15 +102,17 @@
#include <iostream>
#endif
-static Ekiga::ServiceCore *service_core = NULL;
+// FIXME: this *MUST* die soon
+static Ekiga::ServiceCorePtr service_core_ptr;
void
-engine_init (int argc,
+engine_init (Ekiga::ServiceCorePtr service_core,
+ int argc,
char *argv [])
{
- service_core = new Ekiga::ServiceCore;
Ekiga::KickStart kickstart;
+ service_core_ptr = service_core;
service_core->add (Ekiga::ServicePtr(new Ekiga::NotificationCore));
@@ -145,8 +147,7 @@ engine_init (int argc,
service_core->add (call_core);
if (!gmconf_personal_details_init (*service_core, &argc, &argv)) {
- delete service_core;
- service_core = NULL;
+ service_core_ptr.reset ();
return;
}
@@ -155,8 +156,7 @@ engine_init (int argc,
#ifndef WIN32
if (!videooutput_x_init (*service_core, &argc, &argv)) {
- delete service_core;
- service_core = NULL;
+ service_core_ptr.reset ();
return;
}
#endif
@@ -170,8 +170,7 @@ engine_init (int argc,
#endif
if (!videoinput_mlogo_init (*service_core, &argc, &argv)) {
- delete service_core;
- service_core = NULL;
+ service_core_ptr.reset ();
return;
}
@@ -213,14 +212,12 @@ engine_init (int argc,
kickstart.kick (*service_core, &argc, &argv);
if (!gtk_core_init (*service_core, &argc, &argv)) {
- delete service_core;
- service_core = NULL;
+ service_core_ptr.reset ();
return;
}
if (!gtk_frontend_init (*service_core, &argc, &argv)) {
- delete service_core;
- service_core = NULL;
+ service_core_ptr.reset ();
return;
}
@@ -257,13 +254,14 @@ engine_init (int argc,
Ekiga::ServiceCore *
engine_get_service_core ()
{
- return service_core;
+ return service_core_ptr.get ();
}
void
engine_stop ()
{
- if (service_core)
- delete service_core;
- service_core = NULL;
+ if (service_core_ptr) {
+
+ service_core_ptr.reset ();
+ }
}
diff --git a/lib/engine/engine.h b/lib/engine/engine.h
index 3237f14..ac31d90 100644
--- a/lib/engine/engine.h
+++ b/lib/engine/engine.h
@@ -45,7 +45,8 @@
* @{
*/
-void engine_init (int argc,
+void engine_init (Ekiga::ServiceCorePtr service_core,
+ int argc,
char *argv[]);
Ekiga::ServiceCore* engine_get_service_core ();
diff --git a/src/ekiga.cpp b/src/ekiga.cpp
index 6f4b1b4..56279c1 100644
--- a/src/ekiga.cpp
+++ b/src/ekiga.cpp
@@ -230,14 +230,15 @@ void GnomeMeeting::BuildGUI ()
void
-GnomeMeeting::InitEngine (int argc,
+GnomeMeeting::InitEngine (Ekiga::ServiceCorePtr service_core,
+ int argc,
char* argv[])
{
PWaitAndSignal m(ep_var_mutex);
Ekiga::Runtime::init ();
- engine_init (argc, argv);
+ engine_init (service_core, argc, argv);
}
void
diff --git a/src/ekiga.h b/src/ekiga.h
index e81fe28..d2ce6e1 100644
--- a/src/ekiga.h
+++ b/src/ekiga.h
@@ -80,7 +80,8 @@ class GnomeMeeting : public PProcess
* BEHAVIOR : Vroom.
* PRE : /
*/
- void InitEngine (int argc,
+ void InitEngine (Ekiga::ServiceCorePtr service_core,
+ int argc,
char* argv[]);
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index f2e1978..c4c1dfa 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -4335,6 +4335,8 @@ main (int argc,
{
GOptionContext *context = NULL;
+ Ekiga::ServiceCorePtr service_core(new Ekiga::ServiceCore);
+
GtkWidget *main_window = NULL;
GtkWidget *assistant_window = NULL;
@@ -4466,7 +4468,7 @@ main (int argc,
/* Init gm_conf */
gm_conf_watch ();
- GnomeMeeting::Process ()->InitEngine (argc, argv);
+ GnomeMeeting::Process ()->InitEngine (service_core, argc, argv);
GnomeMeeting::Process ()->BuildGUI ();
/* Show the window if there is no error, exit with a popup if there
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]