Skip to content

Commit

Permalink
Merge pull request #560 from rcythr/develop
Browse files Browse the repository at this point in the history
Handlers are now wrapped in a try-catch
  • Loading branch information
apathyboy committed Mar 31, 2013
2 parents fc127c2 + 5c66420 commit 9884768
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/swganh/event_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See file LICENSE or go to http://swganh.com/LICENSE

#include "event_dispatcher.h"
#include "logger.h"

#include <algorithm>

Expand Down Expand Up @@ -105,7 +106,14 @@ void EventDispatcher::InvokeCallbacks(const shared_ptr<EventInterface>& dispatch
end(event_type_iter->second),
[&dispatch_event] (const EventHandlerList::value_type& handler)
{
handler.second(dispatch_event);
try
{
handler.second(dispatch_event);
}
catch(...)
{
DLOG(warning) << "A handler callback caused an exception.";
}
});
}
}
Expand All @@ -118,4 +126,4 @@ void EventDispatcher::Shutdown()
item.second.clear();
}
event_handlers_.clear();
}
}

0 comments on commit 9884768

Please sign in to comment.