Skip to content

Commit

Permalink
libdeng2|Loop: Catch exceptions thrown during loop iteration
Browse files Browse the repository at this point in the history
Uncaught exceptions will not be tolerated in the Qt event loop.
  • Loading branch information
skyjake committed Mar 8, 2013
1 parent 5a2aa49 commit f00a725
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions doomsday/libdeng2/src/core/loop.cpp
Expand Up @@ -17,6 +17,7 @@
*/

#include "de/Loop"
#include "de/App"
#include "de/Time"
#include "de/Log"
#include "de/math.h"
Expand Down Expand Up @@ -71,9 +72,20 @@ void Loop::resume()

void Loop::nextLoopIteration()
{
if(d->running)
try
{
DENG2_FOR_AUDIENCE(Iteration, i) i->loopIteration();
if(d->running)
{
DENG2_FOR_AUDIENCE(Iteration, i) i->loopIteration();
}
}
catch(Error const &er)
{
LOG_AS("Loop");

// This is called from Qt's event loop, we mustn't let exceptions
// out of here uncaught.
App::app().handleUncaughtException("Uncaught exception during loop iteration:\n" + er.asText());
}
}

Expand Down

0 comments on commit f00a725

Please sign in to comment.