mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
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:
parent
e8d5f49d1e
commit
5fc6112ca0
@ -5,15 +5,14 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
SideBar::SideBar(MainWindow *main, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SideBar)
|
||||
SideBar::SideBar(MainWindow *main) :
|
||||
QWidget(main),
|
||||
ui(new Ui::SideBar),
|
||||
// Radare core found in:
|
||||
main(main)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Radare core found in:
|
||||
this->main = main;
|
||||
|
||||
QSettings settings("iaito", "iaito");
|
||||
if (settings.value("responsive").toBool()) {
|
||||
ui->respButton->setChecked(true);
|
||||
@ -44,24 +43,7 @@ void SideBar::on_consoleButton_clicked()
|
||||
|
||||
void SideBar::on_webServerButton_clicked()
|
||||
{
|
||||
static WebServerThread thread;
|
||||
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
|
||||
}
|
||||
main->setWebServerState(ui->webServerButton->isChecked());
|
||||
}
|
||||
|
||||
void SideBar::on_lockButton_clicked()
|
||||
|
@ -14,7 +14,7 @@ class SideBar : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SideBar(MainWindow *main, QWidget *parent = 0);
|
||||
explicit SideBar(MainWindow *main);
|
||||
~SideBar();
|
||||
|
||||
public slots:
|
||||
@ -43,7 +43,7 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::SideBar *ui;
|
||||
MainWindow *main;
|
||||
MainWindow *main;
|
||||
};
|
||||
|
||||
#endif // SIDEBAR_H
|
||||
|
Loading…
Reference in New Issue
Block a user