Catch std::bad_alloc thrown by ElfReader on MinGW.

Change-Id: Ide5445e1cf488c29be620287759147251bc7c26a
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Friedemann Kleint
2012-08-28 10:44:19 +02:00
committed by hjk
parent 81b431cdca
commit a8ba7054f5

View File

@@ -228,6 +228,7 @@ void ModulesModel::removeModule(const QString &modulePath)
void ModulesModel::updateModule(const Module &module)
{
const int row = indexOfModule(module.modulePath);
try { // MinGW occasionallly throws std::bad_alloc.
ElfReader reader(module.modulePath);
ElfData elfData = reader.readHeaders();
@@ -242,6 +243,10 @@ void ModulesModel::updateModule(const Module &module)
m_modules[row].elfData = elfData;
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));
}
}
//////////////////////////////////////////////////////////////////