From 4b8466e5e5f7dbad544cb3405e5fa9e65d9d2e93 Mon Sep 17 00:00:00 2001 From: hypnosis-i2p Date: Sun, 19 Jun 2016 20:44:23 +0800 Subject: [PATCH] restored backg. thread; removed deinit() --- qt/i2pd_qt/DaemonQT.cpp | 60 +++++++++++++++++++---------------------- qt/i2pd_qt/DaemonQT.h | 1 - 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/qt/i2pd_qt/DaemonQT.cpp b/qt/i2pd_qt/DaemonQT.cpp index 2f8a824f..5cd43858 100644 --- a/qt/i2pd_qt/DaemonQT.cpp +++ b/qt/i2pd_qt/DaemonQT.cpp @@ -78,11 +78,6 @@ namespace qt setRunningCallback(0); m_IsRunning=false; return Daemon.init(argc,argv); - - } - void DaemonQTImpl::deinit() - { - delete mutex; mutex = nullptr; } void DaemonQTImpl::start() @@ -129,34 +124,35 @@ namespace qt int RunQT (int argc, char* argv[]) { - //int result = runGUI(argc, argv); - //QMessageBox::information(0,"Debug","runGUI completed"); - QApplication app(argc, argv); - DaemonQTImpl daemon; - qDebug("Initialising the daemon..."); - bool daemonInitSuccess = daemon.init(argc, argv); - if(!daemonInitSuccess) - { - QMessageBox::critical(0, "Error", "Daemon init failed"); - return 1; - } - qDebug("Initialised, creating the main window..."); - MainWindow w; - qDebug("Before main window.show()..."); - w.show (); - int result; - { - /* i2p::qt::Controller daemonQtController(daemon); - qDebug("Starting the daemon..."); - emit daemonQtController.startDaemon(); - qDebug("Starting gui event loop...");*/ - daemon.start (); - result = app.exec(); - daemon.stop (); - } - daemon.deinit(); + QApplication app(argc, argv); + int result; + + { + DaemonQTImpl daemon; + qDebug("Initialising the daemon..."); + bool daemonInitSuccess = daemon.init(argc, argv); + if(!daemonInitSuccess) + { + QMessageBox::critical(0, "Error", "Daemon init failed"); + return 1; + } + qDebug("Initialised, creating the main window..."); + MainWindow w; + qDebug("Before main window.show()..."); + w.show (); + + { + i2p::qt::Controller daemonQtController(daemon); + qDebug("Starting the daemon..."); + emit daemonQtController.startDaemon(); + //daemon.start (); + qDebug("Starting GUI event loop..."); + result = app.exec(); + //daemon.stop (); + } + } + //QMessageBox::information(&w, "Debug", "demon stopped"); - //exit(result); //return from main() causes intermittent sigsegv bugs in some Androids. exit() is a workaround for this qDebug("Exiting the application"); return result; } diff --git a/qt/i2pd_qt/DaemonQT.h b/qt/i2pd_qt/DaemonQT.h index 85a9dccd..98e8b4e6 100644 --- a/qt/i2pd_qt/DaemonQT.h +++ b/qt/i2pd_qt/DaemonQT.h @@ -25,7 +25,6 @@ namespace qt * @return success */ bool init(int argc, char* argv[]); - void deinit(); void start(); void stop(); void restart();