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()
|
||||
{
|
||||
log(tr("Loading Binary...\n"));
|
||||
openFailed = false;
|
||||
|
||||
Core()->setCPU(options.arch, options.cpu, options.bits);
|
||||
|
||||
@ -46,6 +47,7 @@ void AnalTask::runTask()
|
||||
options.forceBinPlugin);
|
||||
if (!fileLoaded) {
|
||||
// Something wrong happened, fallback to open dialog
|
||||
openFailed = true;
|
||||
emit openFileFailed();
|
||||
interrupt();
|
||||
return;
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
|
||||
void interrupt() override;
|
||||
|
||||
bool getOpenFileFailed() { return openFailed; }
|
||||
|
||||
protected:
|
||||
void runTask() override;
|
||||
|
||||
@ -61,6 +63,8 @@ signals:
|
||||
|
||||
private:
|
||||
InitialOptions options;
|
||||
|
||||
bool openFailed = false;
|
||||
};
|
||||
|
||||
#endif // ANALTHREAD_H
|
||||
|
@ -57,7 +57,6 @@ void AsyncTaskDialog::updateProgressTimer()
|
||||
label += " ";
|
||||
}
|
||||
label += tr("%n seconds", "%n second", secondsElapsed % 60);
|
||||
printf("setText %s\n", label.toLocal8Bit().constData());
|
||||
ui->timeLabel->setText(label);
|
||||
}
|
||||
|
||||
|
@ -237,8 +237,14 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
||||
AnalTask *analTask = new AnalTask();
|
||||
analTask->setOptions(options);
|
||||
|
||||
MainWindow *main = this->main;
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user