[hyena] Handle exceptions in SourceAdded (bgo#612407)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Handle exceptions in SourceAdded (bgo#612407)
- Date: Wed, 26 May 2010 02:36:37 +0000 (UTC)
commit 772a4b829aa22dd00e4a0f8475bda72a2c2d304a
Author: Alexander Kojevnikov <alexander kojevnikov com>
Date: Thu Mar 25 13:56:10 2010 +1100
Handle exceptions in SourceAdded (bgo#612407)
src/Hyena/Hyena/EventArgs.cs | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/Hyena/Hyena/EventArgs.cs b/src/Hyena/Hyena/EventArgs.cs
index 7603a9c..7ac9ccc 100644
--- a/src/Hyena/Hyena/EventArgs.cs
+++ b/src/Hyena/Hyena/EventArgs.cs
@@ -4,7 +4,7 @@
// Author:
// Alexander Kojevnikov <alexander kojevnikov com>
//
-// Copyright (C) 2009 Alexander Kojevnikov
+// Copyright (C) 2009-2010 Alexander Kojevnikov
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -26,6 +26,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
+
namespace Hyena
{
public class EventArgs<T> : System.EventArgs
@@ -41,4 +43,21 @@ namespace Hyena
get { return value; }
}
}
+
+ public static class EventExtensions
+ {
+ public static void SafeInvoke<T> (this T @event, params object[] args) where T : class
+ {
+ var multicast = @event as MulticastDelegate;
+ if (multicast != null) {
+ foreach (var handler in multicast.GetInvocationList ()) {
+ try {
+ handler.DynamicInvoke (args);
+ } catch (Exception e) {
+ Log.Exception (e);
+ }
+ }
+ }
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]