aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/moduleshandler.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2012-08-28 10:44:19 +0200
committerhjk <[email protected]>2012-08-28 10:47:29 +0200
commita8ba7054f5a6ff117edb43d50574d3de150a92d3 (patch)
treed80f26559aa1480fe63ca665aa331a82a3dc2861 /src/plugins/debugger/moduleshandler.cpp
parent81b431cdcaacf2951bdc4315cf1459615857ca03 (diff)
Catch std::bad_alloc thrown by ElfReader on MinGW.
Diffstat (limited to 'src/plugins/debugger/moduleshandler.cpp')
-rw-r--r--src/plugins/debugger/moduleshandler.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp
index c32e1680fb7..7c9dcc06cbd 100644
--- a/src/plugins/debugger/moduleshandler.cpp
+++ b/src/plugins/debugger/moduleshandler.cpp
@@ -228,19 +228,24 @@ void ModulesModel::removeModule(const QString &modulePath)
void ModulesModel::updateModule(const Module &module)
{
const int row = indexOfModule(module.modulePath);
- ElfReader reader(module.modulePath);
- ElfData elfData = reader.readHeaders();
+ try { // MinGW occasionallly throws std::bad_alloc.
+ ElfReader reader(module.modulePath);
+ ElfData elfData = reader.readHeaders();
- if (row == -1) {
- const int n = m_modules.size();
- beginInsertRows(QModelIndex(), n, n);
- m_modules.push_back(module);
- m_modules.back().elfData = elfData;
- endInsertRows();
- } else {
- m_modules[row] = module;
- m_modules[row].elfData = elfData;
- dataChanged(index(row, 0, QModelIndex()), index(row, 4, QModelIndex()));
+ if (row == -1) {
+ const int n = m_modules.size();
+ beginInsertRows(QModelIndex(), n, n);
+ m_modules.push_back(module);
+ m_modules.back().elfData = elfData;
+ endInsertRows();
+ } else {
+ m_modules[row] = 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));
}
}