Permalink
Browse files

Merge pull request #560 from rcythr/develop

Handlers are now wrapped in a try-catch
  • Loading branch information...
2 parents fc127c2 + 5c66420 commit 98847688961ebe9ea548c6a5e2ebd99fc3c54aa4 @apathyboy apathyboy committed Mar 31, 2013
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/swganh/event_dispatcher.cc
@@ -2,6 +2,7 @@
// See file LICENSE or go to http://swganh.com/LICENSE
#include "event_dispatcher.h"
+#include "logger.h"
#include <algorithm>
@@ -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.";
+ }
});
}
}
@@ -118,4 +126,4 @@ void EventDispatcher::Shutdown()
item.second.clear();
}
event_handlers_.clear();
-}
+}

0 comments on commit 9884768

Please sign in to comment.