picoe / Eto

Cross platform GUI framework for desktop and mobile applications in .NET
Other
3.67k stars 333 forks source link

WebView crashes on OpenNewWindow event #303

Closed slothbag closed 9 years ago

slothbag commented 9 years ago

I have a Eto application using an embedded webview control as the main interface. I have a href link that uses "data:text/json,{"blah:"blah"}" as its link with a target="_blank".

Eto WebView fires the OpenNewWindow event (which seems correct), but after returning from this event delegate, the app crashes. It makes no difference if I do a WebViewNewWindowEventArgs.cancel = true or false.

Platform is Ubuntu Linux

Marshaling new-window-policy-decision-requested signal
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Eto.GtkSharp.Forms.Controls.WebViewHandler+WebViewConnector.HandleNewWindowPolicyDecisionRequested (System.Object sender, Eto.GtkSharp.NewWindowPolicyDecisionRequestedArgs args) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in <filename unknown>:0 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <filename unknown>:0 
  at GLib.Signal.ClosureInvokedCB (System.Object o, GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.Invoke (GLib.ClosureInvokedArgs args) [0x00000] in <filename unknown>:0 
  at GLib.SignalClosure.MarshalCallback (IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data) [0x00000] in <filename unknown>:0 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at Eto.GtkSharp.Forms.ApplicationHandler.Run()
slothbag commented 9 years ago

Oh, and the target for the href is _blank hence why the OpenNewWindow event fires :)

slothbag commented 9 years ago

Here's a sample app that triggers the crash.. i'm using Ubuntu linux 64 bit.

https://gist.github.com/slothbag/5b802f34fa3df5fbd9a5