forked from qt-creator/qt-creator
Catch std::bad_alloc thrown by ElfReader on MinGW.
Change-Id: Ide5445e1cf488c29be620287759147251bc7c26a Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -228,19 +228,24 @@ void ModulesModel::removeModule(const QString &modulePath)
|
|||||||
void ModulesModel::updateModule(const Module &module)
|
void ModulesModel::updateModule(const Module &module)
|
||||||
{
|
{
|
||||||
const int row = indexOfModule(module.modulePath);
|
const int row = indexOfModule(module.modulePath);
|
||||||
ElfReader reader(module.modulePath);
|
try { // MinGW occasionallly throws std::bad_alloc.
|
||||||
ElfData elfData = reader.readHeaders();
|
ElfReader reader(module.modulePath);
|
||||||
|
ElfData elfData = reader.readHeaders();
|
||||||
|
|
||||||
if (row == -1) {
|
if (row == -1) {
|
||||||
const int n = m_modules.size();
|
const int n = m_modules.size();
|
||||||
beginInsertRows(QModelIndex(), n, n);
|
beginInsertRows(QModelIndex(), n, n);
|
||||||
m_modules.push_back(module);
|
m_modules.push_back(module);
|
||||||
m_modules.back().elfData = elfData;
|
m_modules.back().elfData = elfData;
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
} else {
|
} else {
|
||||||
m_modules[row] = module;
|
m_modules[row] = module;
|
||||||
m_modules[row].elfData = elfData;
|
m_modules[row].elfData = elfData;
|
||||||
dataChanged(index(row, 0, QModelIndex()), index(row, 4, QModelIndex()));
|
dataChanged(index(row, 0, QModelIndex()), index(row, 4, QModelIndex()));
|
||||||
|
}
|
||||||
|
} catch(...) {
|
||||||
|
qWarning("%s: An exception occurred while reading module '%s'",
|
||||||
|
Q_FUNC_INFO, qPrintable(module.modulePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user