Catch std::bad_alloc exception.
--HG-- branch : develop
This commit is contained in:
parent
db8cf12d49
commit
07f75f7212
|
@ -1888,6 +1888,25 @@ void MainWindow::LoadPattern(const QString &fileName)
|
||||||
Clear();
|
Clear();
|
||||||
return;
|
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<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &MainWindow::currentDrawChanged);
|
this, &MainWindow::currentDrawChanged);
|
||||||
QString nameDraw = doc->GetNameActivDraw();
|
QString nameDraw = doc->GetNameActivDraw();
|
||||||
|
|
|
@ -601,6 +601,9 @@ void VPattern::FullUpdateTree()
|
||||||
catch (const std::bad_alloc &)
|
catch (const std::bad_alloc &)
|
||||||
{
|
{
|
||||||
delete scene;
|
delete scene;
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
#endif
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setWindowTitle(tr("Error!"));
|
msgBox.setWindowTitle(tr("Error!"));
|
||||||
msgBox.setText(tr("Error parsing file."));
|
msgBox.setText(tr("Error parsing file."));
|
||||||
|
@ -609,6 +612,9 @@ void VPattern::FullUpdateTree()
|
||||||
msgBox.setDefaultButton(QMessageBox::Ok);
|
msgBox.setDefaultButton(QMessageBox::Ok);
|
||||||
msgBox.setIcon(QMessageBox::Warning);
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
#endif
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user