Commit abe05dbd authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

manager: catch exceptions in mainloop

This patch prevents exceptions to crash application
if happen during pollEvents() processing.
Exception are just catch and displayed.
In case of exception caused by a task, this one
is removed from pending list.
Handlers are not removed, take care of that!

Change-Id: I266539585baf68f329d53f3d20361c4cb08211f3
Tuleap: #200
parent 2def1015
......@@ -1407,7 +1407,11 @@ void Manager::pollEvents()
// Think twice before modify this code.
nextEventHandler_ = std::next(iter);
try {
} catch (const std::exception& e) {
RING_ERR("MainLoop exception (handler): %s", e.what());
iter = nextEventHandler_;
......@@ -1422,7 +1426,14 @@ void Manager::pollEvents()
auto next = std::next(iter);
if (not (*iter)())
bool result;
try {
result = (*iter)();
} catch (const std::exception& e) {
RING_ERR("MainLoop exception (task): %s", e.what());
result = false;
if (not result)
iter = next;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment