Browse Source

restored backg. thread; removed deinit()

pull/526/head
hypnosis-i2p 9 years ago
parent
commit
4b8466e5e5
  1. 60
      qt/i2pd_qt/DaemonQT.cpp
  2. 1
      qt/i2pd_qt/DaemonQT.h

60
qt/i2pd_qt/DaemonQT.cpp

@ -78,11 +78,6 @@ namespace qt
setRunningCallback(0); setRunningCallback(0);
m_IsRunning=false; m_IsRunning=false;
return Daemon.init(argc,argv); return Daemon.init(argc,argv);
}
void DaemonQTImpl::deinit()
{
delete mutex; mutex = nullptr;
} }
void DaemonQTImpl::start() void DaemonQTImpl::start()
@ -129,34 +124,35 @@ namespace qt
int RunQT (int argc, char* argv[]) int RunQT (int argc, char* argv[])
{ {
//int result = runGUI(argc, argv); QApplication app(argc, argv);
//QMessageBox::information(0,"Debug","runGUI completed"); int result;
QApplication app(argc, argv);
DaemonQTImpl daemon; {
qDebug("Initialising the daemon..."); DaemonQTImpl daemon;
bool daemonInitSuccess = daemon.init(argc, argv); qDebug("Initialising the daemon...");
if(!daemonInitSuccess) bool daemonInitSuccess = daemon.init(argc, argv);
{ if(!daemonInitSuccess)
QMessageBox::critical(0, "Error", "Daemon init failed"); {
return 1; QMessageBox::critical(0, "Error", "Daemon init failed");
} return 1;
qDebug("Initialised, creating the main window..."); }
MainWindow w; qDebug("Initialised, creating the main window...");
qDebug("Before main window.show()..."); MainWindow w;
w.show (); qDebug("Before main window.show()...");
int result; w.show ();
{
/* i2p::qt::Controller daemonQtController(daemon); {
qDebug("Starting the daemon..."); i2p::qt::Controller daemonQtController(daemon);
emit daemonQtController.startDaemon(); qDebug("Starting the daemon...");
qDebug("Starting gui event loop...");*/ emit daemonQtController.startDaemon();
daemon.start (); //daemon.start ();
result = app.exec(); qDebug("Starting GUI event loop...");
daemon.stop (); result = app.exec();
} //daemon.stop ();
daemon.deinit(); }
}
//QMessageBox::information(&w, "Debug", "demon stopped"); //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"); qDebug("Exiting the application");
return result; return result;
} }

1
qt/i2pd_qt/DaemonQT.h

@ -25,7 +25,6 @@ namespace qt
* @return success * @return success
*/ */
bool init(int argc, char* argv[]); bool init(int argc, char* argv[]);
void deinit();
void start(); void start();
void stop(); void stop();
void restart(); void restart();

Loading…
Cancel
Save