[Gtk-sharp-list] Strange Exceptioon in WebKit.WebView

stacheldraht at interia.pl stacheldraht at interia.pl
Tue Feb 9 15:05:37 EST 2010


Hi folks,

I've just encountered a very strange exception in one of my Gtk# apps, which 
makes use of webkit-sharp. It occurs every time I try to load some HTML into 
the WebView:

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to 
handle the exception.
System.Exception: args.RetVal or 'out' property unset or set to incorrect type 
in WebKit.NavigationRequestedHandler callback
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, 
Boolean is_terminal) in /usr/src/packages/BUILD/gtk-
sharp-2.12.9/glib/ExceptionManager.cs:line 58
   at WebKit.WebView.NavigationRequestedSignalCallback(IntPtr arg0, IntPtr 
arg1, IntPtr arg2, IntPtr gch)
   at WebKit.WebView.webkit_web_view_load_html_string(IntPtr , IntPtr , IntPtr 
)
   at WebKit.WebView.LoadHtmlString(System.String content, System.String 
base_uri)
   at iwawi.cockpits.TeleSalesCockpit.ReadBrowserPage(Int32 customerID) in 
/home/jacek/Documents/Projects/iwawi/iwawi/cockpits/TeleSalesCockpit.cs:line 
314
   at 
iwawi.cockpits.TeleSalesCockpit.OnCustomerSelectionTreeViewItemActivated(System.Object 
o, Gtk.RowActivatedArgs args) in 
/home/jacek/Documents/Projects/iwawi/iwawi/cockpits/TeleSalesCockpit.cs:line 
210

This is my sourcecode:

		private void InitBrowser ()
		{
			browser = new WebView();
			this.browser.Editable = false;
			this.browser.LoadHtmlString("<html></html>", null);
			this.browser.NavigationRequested +=
				new NavigationRequestedHandler(this.OnLinkActivatedInBrowser);
			this.browser.HoveringOverLink +=
				new HoveringOverLinkHandler(OnHoveringOverLinkInBrowser);
			this.browserScrollPane.AddWithViewport(this.browser);
			this.browserScrollPane.ShowAll();
		}
		
		private void ReadBrowserPage (int customerID)
		{			
			string html = "";
			this.Hourglass = true;
			StringBuilder sb = new StringBuilder();
			
			try {
				IDbCommand cmd = this.handler.conn.CreateCommand();
				sb.Append("SELECT * FROM appdata.skeleton_cockpit_telesales (\'");
				sb.Append(ApplicationInfo.language);
				sb.Append("\', ");
				sb.Append(customerID);
				sb.Append(") AS cockpit_page;");
				
				cmd.CommandText = sb.ToString();
				IDataReader r = cmd.ExecuteReader();
				
				if ((r.Read())) {
					html = (r ["cockpit_page"]).ToString();
				}
				
				r.Close();
				r = null;
				this.Hourglass = false;
			}
			catch (NpgsqlException ex) {
				this.Hourglass = false;
				GeneralUseDialog errorDialog = new GeneralUseDialog
					("Cockpit konnte nicht aufgebaut werden. Ursache:\n" + ex.Message,
					"Abfrage gescheitert", Gtk.IconTheme.Default.LoadIcon("gtk-dialog-error", 
32, 0),
					false);
			}
			
			this.browser.LoadHtmlString(html, null);
		}

First I call InitBrowser() to initialize the browser window and to implant it 
into my application. Then I add two event handlers (one for hovering, one for 
navigation events). And when I try to put some HTML into the browser by 
calling ReadBrowserPage(), the crash happens.

However, when I do not add the navigation event handler, everything works 
fine.

Any ideas how to get this issue resolved? Thank you for all helpful advice.

Regards
Jacek Rużyczka

----------------------------------------------------------------------
Urocze domki...
Zobacz >>> http://link.interia.pl/f25aa



More information about the Gtk-sharp-list mailing list