[gbrainy] Control & report exception when opening the help file



commit c381c9999abffe407c170f351892502a1bdd9720
Author: Jordi Mas <jmas softcatala org>
Date:   Fri Jan 4 16:57:57 2013 +0100

    Control & report exception when opening the help file

 src/Core/Platform/Unix.cs |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/Core/Platform/Unix.cs b/src/Core/Platform/Unix.cs
index 043e713..f23f2a9 100644
--- a/src/Core/Platform/Unix.cs
+++ b/src/Core/Platform/Unix.cs
@@ -107,13 +107,24 @@ namespace gbrainy.Core.Platform
 
 		public static unsafe bool ShowUri (Gdk.Screen screen, string uri, uint timestamp)
 		{
-			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
-			IntPtr error = IntPtr.Zero;
-			bool raw_ret = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
-			bool ret = raw_ret;
-			GLib.Marshaller.Free (native_uri);
-			if (error != IntPtr.Zero) throw new GLib.GException (error);
-			return ret;
+
+			bool rslt = false;
+
+			try {
+				IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
+				IntPtr error = IntPtr.Zero;
+				rslt = gtk_show_uri(screen == null ? IntPtr.Zero : screen.Handle, native_uri, timestamp, out error);
+				GLib.Marshaller.Free (native_uri);
+
+				if (error != IntPtr.Zero) 
+					throw new GLib.GException (error);
+			}
+
+			catch (Exception e) {
+				Console.WriteLine ("Unix.ShowUri. Error {0}", e);
+			}
+
+			return rslt;
 		}
 
 		public static void PlaySound(IntPtr widget, string filename)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]