diff --git a/src/app/main.cpp b/src/app/main.cpp index 36fa72ab6..a9a470cfd 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -187,12 +187,12 @@ int main(int argc, char *argv[]) parser.addVersionOption(); parser.addPositionalArgument("filename", QCoreApplication::translate("main", "Pattern file.")); parser.process(app); - const QStringList args = parser.positionalArguments(); + QStringList args = parser.positionalArguments(); //Before we load pattern show window. w.show(); - w.ReopenFilesAfterCrash(); + w.ReopenFilesAfterCrash(args); for (int i=0;igetSettings()->value("restoreFileList").toStringList(); if (files.size() > 0) @@ -2308,6 +2308,7 @@ void MainWindow::ReopenFilesAfterCrash() QFile autoFile(restoreFiles.at(i) +".autosave"); autoFile.remove(); LoadPattern(restoreFiles.at(i)); + args.removeAll(restoreFiles.at(i));// Do not open file twice after we restore him. } else { diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index 9f32d8e34..d12419374 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -56,7 +56,7 @@ public: explicit MainWindow(QWidget *parent = nullptr); virtual ~MainWindow(); void LoadPattern(const QString &curFile); - void ReopenFilesAfterCrash(); + void ReopenFilesAfterCrash(QStringList &args); public slots: void mouseMove(const QPointF &scenePos); void ArrowTool();