mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Do not show MainWindow if loading failed
This commit is contained in:
parent
9ecca8fe38
commit
5777b1905c
@ -24,6 +24,7 @@ void AnalTask::interrupt()
|
|||||||
void AnalTask::runTask()
|
void AnalTask::runTask()
|
||||||
{
|
{
|
||||||
log(tr("Loading Binary...\n"));
|
log(tr("Loading Binary...\n"));
|
||||||
|
openFailed = false;
|
||||||
|
|
||||||
Core()->setCPU(options.arch, options.cpu, options.bits);
|
Core()->setCPU(options.arch, options.cpu, options.bits);
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ void AnalTask::runTask()
|
|||||||
options.forceBinPlugin);
|
options.forceBinPlugin);
|
||||||
if (!fileLoaded) {
|
if (!fileLoaded) {
|
||||||
// Something wrong happened, fallback to open dialog
|
// Something wrong happened, fallback to open dialog
|
||||||
|
openFailed = true;
|
||||||
emit openFileFailed();
|
emit openFileFailed();
|
||||||
interrupt();
|
interrupt();
|
||||||
return;
|
return;
|
||||||
|
@ -53,6 +53,8 @@ public:
|
|||||||
|
|
||||||
void interrupt() override;
|
void interrupt() override;
|
||||||
|
|
||||||
|
bool getOpenFileFailed() { return openFailed; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void runTask() override;
|
void runTask() override;
|
||||||
|
|
||||||
@ -61,6 +63,8 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
InitialOptions options;
|
InitialOptions options;
|
||||||
|
|
||||||
|
bool openFailed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ANALTHREAD_H
|
#endif // ANALTHREAD_H
|
||||||
|
@ -57,7 +57,6 @@ void AsyncTaskDialog::updateProgressTimer()
|
|||||||
label += " ";
|
label += " ";
|
||||||
}
|
}
|
||||||
label += tr("%n seconds", "%n second", secondsElapsed % 60);
|
label += tr("%n seconds", "%n second", secondsElapsed % 60);
|
||||||
printf("setText %s\n", label.toLocal8Bit().constData());
|
|
||||||
ui->timeLabel->setText(label);
|
ui->timeLabel->setText(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,8 +237,14 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
|||||||
AnalTask *analTask = new AnalTask();
|
AnalTask *analTask = new AnalTask();
|
||||||
analTask->setOptions(options);
|
analTask->setOptions(options);
|
||||||
|
|
||||||
|
MainWindow *main = this->main;
|
||||||
connect(analTask, &AnalTask::openFileFailed, main, &MainWindow::openNewFileFailed);
|
connect(analTask, &AnalTask::openFileFailed, main, &MainWindow::openNewFileFailed);
|
||||||
connect(analTask, &AsyncTask::finished, main, &MainWindow::finalizeOpen);
|
connect(analTask, &AsyncTask::finished, main, [analTask, main]() {
|
||||||
|
if (analTask->getOpenFileFailed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
main->finalizeOpen();
|
||||||
|
});
|
||||||
|
|
||||||
AsyncTask::Ptr analTaskPtr(analTask);
|
AsyncTask::Ptr analTaskPtr(analTask);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user