fixes a possible crash on exit

- remove unsued constructor parameter. MainWindow is a QWidget
- remove duplicated code. Call MainWindow::setWebServerState
This commit is contained in:
ballessay 2017-04-01 04:09:03 +02:00
parent e8d5f49d1e
commit 5fc6112ca0
2 changed files with 8 additions and 26 deletions

View File

@ -5,15 +5,14 @@
#include "mainwindow.h" #include "mainwindow.h"
SideBar::SideBar(MainWindow *main, QWidget *parent) : SideBar::SideBar(MainWindow *main) :
QWidget(parent), QWidget(main),
ui(new Ui::SideBar) ui(new Ui::SideBar),
// Radare core found in:
main(main)
{ {
ui->setupUi(this); ui->setupUi(this);
// Radare core found in:
this->main = main;
QSettings settings("iaito", "iaito"); QSettings settings("iaito", "iaito");
if (settings.value("responsive").toBool()) { if (settings.value("responsive").toBool()) {
ui->respButton->setChecked(true); ui->respButton->setChecked(true);
@ -44,24 +43,7 @@ void SideBar::on_consoleButton_clicked()
void SideBar::on_webServerButton_clicked() void SideBar::on_webServerButton_clicked()
{ {
static WebServerThread thread; main->setWebServerState(ui->webServerButton->isChecked());
if (ui->webServerButton->isChecked()) {
// Start web server
thread.core = this->main->core;
thread.start();
QThread::sleep (1);
if (this->main->core->core->http_up==R_FALSE) {
eprintf ("FAILED TO LAUNCH\n");
}
// Open web interface on default browser
//QString link = "http://localhost:9090/";
//QDesktopServices::openUrl(QUrl(link));
} else {
this->main->core->core->http_up= R_FALSE;
// call something to kill the webserver!!
thread.exit(0);
// Stop web server
}
} }
void SideBar::on_lockButton_clicked() void SideBar::on_lockButton_clicked()

View File

@ -14,7 +14,7 @@ class SideBar : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SideBar(MainWindow *main, QWidget *parent = 0); explicit SideBar(MainWindow *main);
~SideBar(); ~SideBar();
public slots: public slots: