diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index a51f09f18..b7e24a78b 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1888,6 +1888,25 @@ void MainWindow::LoadPattern(const QString &fileName) Clear(); return; } + catch (const std::bad_alloc &) + { +#ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); +#endif + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Error parsing file.")); + msgBox.setInformativeText("std::bad_alloc"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setIcon(QMessageBox::Warning); + msgBox.exec(); +#ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); +#endif + Clear(); + return; + } connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::currentDrawChanged); QString nameDraw = doc->GetNameActivDraw(); diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index 0594b0563..67bd9edc1 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -601,6 +601,9 @@ void VPattern::FullUpdateTree() catch (const std::bad_alloc &) { delete scene; +#ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); +#endif QMessageBox msgBox; msgBox.setWindowTitle(tr("Error!")); msgBox.setText(tr("Error parsing file.")); @@ -609,6 +612,9 @@ void VPattern::FullUpdateTree() msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setIcon(QMessageBox::Warning); msgBox.exec(); +#ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); +#endif emit ClearMainWindow(); return; }