Revision
16103
Author
jmesquita
Date
2009-12-30 23:43:07 -0600 (Wed, 30 Dec 2009)

Log Message

Wait for the core to shutdown upon exit.

Modified Paths

Diff

Modified: freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp (16102 => 16103)


--- freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp	2009-12-31 05:08:40 UTC (rev 16102)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.cpp	2009-12-31 05:43:07 UTC (rev 16103)
@@ -9,19 +9,12 @@
     switch_core_set_globals();
 }
 
-FSHost::~FSHost()
-{
-    switch_status_t destroy_status;
-    /* When the runtime loop exits, its time to shutdown */
-    destroy_status = switch_core_destroy();
-    wait();
-}
-
 void FSHost::run(void)
 {
     switch_core_flag_t flags = SCF_USE_SQL;
     const char *err = NULL;
     switch_bool_t console = SWITCH_FALSE;
+    switch_status_t destroy_status;
 
     /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
     printf("Initializing core...\n");
@@ -38,6 +31,9 @@
      */
     switch_core_runtime_loop(!console);
     fflush(stdout);
+
+    /* When the runtime loop exits, its time to shutdown */
+    destroy_status = switch_core_destroy();
 }
 
 switch_status_t FSHost::sendCmd(const char *cmd, const char *args, QString *res)

Modified: freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h (16102 => 16103)


--- freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h	2009-12-31 05:08:40 UTC (rev 16102)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/fshost.h	2009-12-31 05:43:07 UTC (rev 16103)
@@ -9,7 +9,6 @@
 Q_OBJECT
 public:
     explicit FSHost(QObject *parent = 0);
-    ~FSHost(void);
     switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
 
 protected:

Modified: freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp (16102 => 16103)


--- freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp	2009-12-31 05:08:40 UTC (rev 16102)
+++ freeswitch/trunk/contrib/jmesquita/FSPhone/mainwindow.cpp	2009-12-31 05:43:07 UTC (rev 16103)
@@ -18,6 +18,9 @@
 MainWindow::~MainWindow()
 {
     delete ui;
+    QString res;
+    this->fshost->sendCmd("fsctl", "shutdown", &res);
+    this->fshost->wait();
 }
 
 void MainWindow::fshostReady()