diff --git a/src/app/valentina/core/vcmdexport.h b/src/app/valentina/core/vcmdexport.h index f252c7b53..f7ef729e8 100644 --- a/src/app/valentina/core/vcmdexport.h +++ b/src/app/valentina/core/vcmdexport.h @@ -29,11 +29,14 @@ inline QTextStream& vStdErr() } //--------------------------------------------------------------------------------------------------------------------- -NORET_ATTR inline void AppAbort(const QString& text, int code = GENERAL_ERROR_STATUS) +NORET_ATTR inline void AppAbort(const QString& text = QString(), int code = GENERAL_ERROR_STATUS) { //well ..std::runtime_error was leading to zombies in memory and a lot of dumping all the time ...better to do just exit //possibly compiler do not have -fexceptions set - vStdErr() << text << "\n"; + if (!text.isEmpty()) + { + vStdErr() << text << "\n"; + } std::exit(code); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/main.cpp b/src/app/valentina/main.cpp index 5c9d042f0..8ecde4a33 100644 --- a/src/app/valentina/main.cpp +++ b/src/app/valentina/main.cpp @@ -31,8 +31,8 @@ #include // For QT_REQUIRE_VERSION // Lock producing random attribute order in XML - // https://stackoverflow.com/questions/27378143/qt-5-produce-random-attribute-order-in-xml - extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; +// https://stackoverflow.com/questions/27378143/qt-5-produce-random-attribute-order-in-xml +extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed; //--------------------------------------------------------------------------------------------------------------------- @@ -69,10 +69,13 @@ int main(int argc, char *argv[]) for (size_t i=0, sz = args.size(); i < sz;++i) { - w.LoadPattern(args.at(static_cast(i)), app.CommandLine()->OptMeasurePath()); + bool loaded = w.LoadPattern(args.at(static_cast(i)), app.CommandLine()->OptMeasurePath()); if (app.CommandLine()->IsExportEnabled()) - { - w.DoExport(app.CommandLine()); + { + if (loaded) + { + w.DoExport(app.CommandLine()); + } break; } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 0093eda05..65c38a29f 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -3024,21 +3024,21 @@ MainWindow::~MainWindow() * @brief LoadPattern open pattern file. * @param fileName name of file. */ -void MainWindow::LoadPattern(const QString &fileName, const QString& customMeasureFile) +bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasureFile) { qCDebug(vMainWindow, "Loading new file %s.", fileName.toUtf8().constData()); //We have unsaved changes or load more then one file per time if (OpenNewValentina(fileName)) { - return; + return false; } if (fileName.isEmpty()) { qCDebug(vMainWindow, "Got empty file."); Clear(); - return; + return false; } #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) @@ -3057,7 +3057,7 @@ void MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu { qCCritical(vMainWindow, "%s", tr("This file already opened in another window.").toUtf8().constData()); Clear(); - return; + return false; } } #endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) @@ -3092,13 +3092,13 @@ void MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu if (path.isEmpty()) { Clear(); - return; + return false; } if (not LoadMeasurements(path)) { Clear(); - return; + return false; } else { @@ -3119,8 +3119,8 @@ void MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu { vStdErr() << tr("File error.") << e.MoreInformation() << "\n"; } - Clear(); - return; + Clear(); + return false; } #ifdef Q_OS_WIN32 @@ -3148,6 +3148,7 @@ void MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu ui->actionDraw->setChecked(true); } + return true; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index a79491c47..d934cfa93 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -60,7 +60,7 @@ class MainWindow : public MainWindowsNoGUI public: explicit MainWindow(QWidget *parent = nullptr); virtual ~MainWindow() Q_DECL_OVERRIDE; - void LoadPattern(const QString &curFile, const QString &customMeasureFile = QString()); + bool LoadPattern(const QString &curFile, const QString &customMeasureFile = QString()); void ReopenFilesAfterCrash(QStringList &args); void DoExport(const VCommandLinePtr& expParams);