simple try/catch patch
Rafael Ferreira <[email protected]>
| Newsgroups | gmane.comp.gnome.mono.documentation |
|---|---|
| Message-ID | <[email protected]> |
Hey guys, this is a simple try/catch patch that should help put an end to the claims of instability of the browser. This patch does not "fix" anything per say but will prevent the browser from crashing if an exception occurs while trying to render a url. I'll commit it sometime in the next few days if I no one is against it. - Rafael _______________________________________________ Mono-docs-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-docs-list
try.patch
(text/x-patch, 1.5 KB)
Index: browser.cs
===================================================================
--- browser.cs (revision 53156)
+++ browser.cs (working copy)
@@ -551,11 +551,18 @@
Node node;
Console.Error.WriteLine ("Trying: {0}", url);
- string res = help_tree.RenderUrl (url, out node);
- if (res != null){
- Render (res, node, url);
- CurrentTab.history.AppendHistory (new LinkPageVisit (this, url));
- return;
+ try {
+ string res = help_tree.RenderUrl (url, out node);
+ if (res != null){
+ Render (res, node, url);
+ CurrentTab.history.AppendHistory (new LinkPageVisit (this, url));
+ return;
+ }
+ } catch (Exception e){
+ Console.WriteLine("#########");
+ Console.WriteLine("Error loading url {0} - excpetion below:",url);
+ Console.WriteLine("#########");
+ Console.WriteLine(e);
}
Console.Error.WriteLine ("+----------------------------------------------+");
Index: BookmarkManager.cs
===================================================================
--- BookmarkManager.cs (revision 53156)
+++ BookmarkManager.cs (working copy)
@@ -426,14 +426,7 @@
if (bk != null) {
if (bk is Bookmark)
- try {
_Browser.LoadUrl( ((Bookmark)bk).Url);
- } catch (Exception ex) {
- Console.WriteLine("##########################");
- Console.WriteLine("Exception loading bookmark:[{0}],",((Bookmark)bk).Url);
- Console.WriteLine("##########################");
- Console.WriteLine(ex);
- }
}
else {
Console.WriteLine("Bookmark error -> could not load bookmark");