From 29552f7d62ad84c3e83fe26afbe125543f149d5f Mon Sep 17 00:00:00 2001
From: Mirco Bauer <meebey@meebey.net>
Date: Thu, 31 Jan 2013 06:32:11 +0100
Subject: [PATCH] Fixed application crash in GTK+ callback when notification
 updates fail

For an example how this can crash an application see here:
https://www.smuxi.org/issues/show/809
---
 src/Notification.cs |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Index: notify-sharp/src/Notification.cs
===================================================================
--- notify-sharp.orig/src/Notification.cs	2013-02-02 17:43:47.023709602 +0800
+++ notify-sharp/src/Notification.cs	2013-02-02 17:45:21.273648920 +0800
@@ -306,9 +306,15 @@
 			if (shown && !updates_pending) {
 				updates_pending = true;
 				GLib.Timeout.Add (100, delegate {
-					if (updates_pending) {
-						Show ();
-						updates_pending = false;
+					try {
+						if (updates_pending) {
+							Show ();
+							updates_pending = false;
+						}
+					} catch (Exception ex) {
+						// do not throw an exception in a GTK+ callback as
+						// this will _crash_ the application
+						Console.WriteLine("Ignoring exception: {0}", ex);
 					}
 					return false;
 				});
