Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gtk Platform throw Exception: Object reference not set to an instance of an object. #1757

Closed
hxbb00 opened this issue Jul 29, 2020 · 8 comments · Fixed by #2194
Closed

gtk Platform throw Exception: Object reference not set to an instance of an object. #1757

hxbb00 opened this issue Jul 29, 2020 · 8 comments · Fixed by #2194
Labels
Milestone

Comments

@hxbb00
Copy link

hxbb00 commented Jul 29, 2020

Actual Behavior

Object reference not set to an instance of an object.

Code that Demonstrates the Problem

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.GtkWindow`3.GtkWindowConnector.HandleWindowSizeAllocated(Object o, SizeAllocatedArgs args)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at GLib.Signal.ClosureInvokedCB(Object o, ClosureInvokedArgs args)
   at GLib.SignalClosure.MarshalCallback(IntPtr raw_closure, IntPtr return_val, UInt32 n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
   at GLib.ExceptionManager.RaiseUnhandledException(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.Run()
   at Eto.GtkSharp.Forms.ApplicationHandler.Run()
   at Eto.Forms.Application.Run(Form mainForm)

Specifications

  • Version:2.5.3
  • Platform(s): Gtk3
  • Operating System(s): Windows 10
@cwensley
Copy link
Member

Hey @hxbb00, thanks for reporting the issue! Do you have an example that causes the issue, or steps to reproduce?

@hxbb00
Copy link
Author

hxbb00 commented Aug 12, 2020

sorry for late,debug with dnspy,crashed at Eto/src/Eto.Gtk/Forms/GtkWindow.cs

GtkWindow<TControl, TWidget, TCallback> handler = this.Handler;

Eto.Drawing.Size size = handler.Size;// System.NullReferenceException: Object reference not set to an instance of an object.

if (handler.Control.IsRealized)
{
	Eto.Drawing.Size? size2 = this.oldSize;
	Eto.Drawing.Size size3 = size;
	if (size2 == null || (size2 != null && size2.GetValueOrDefault() != size3))
	{
		TCallback callback = handler.Callback;
		callback.OnSizeChanged(this.Handler.Widget, EventArgs.Empty);
		if (handler.WindowState == Eto.Forms.WindowState.Normal)
		{
			handler.restoreBounds = new Eto.Drawing.Rectangle?(handler.Widget.Bounds);
		}
		this.oldSize = new Eto.Drawing.Size?(size);
	}
}

@hxbb00
Copy link
Author

hxbb00 commented Aug 18, 2020

image
@cwensley

@hxbb00
Copy link
Author

hxbb00 commented Aug 18, 2020

image

@hxbb00
Copy link
Author

hxbb00 commented Aug 18, 2020

image
ButtonMenuItemConnector also null pointer

@cwensley
Copy link
Member

Hey @hxbb00, thanks for referencing where the error is occurring, but do you have some of your code that demonstrates how to replicate this crash?

@hxbb00
Copy link
Author

hxbb00 commented Aug 19, 2020

Hey @hxbb00, thanks for referencing where the error is occurring, but do you have some of your code that demonstrates how to replicate this crash?

my project environment is huge,the files is almost 2Gb,and i do not know how it happen,can not write a tiny demo,i will continue to find the reason,Thanks for your attention

@cwensley
Copy link
Member

Ok no problem, please let me know if you do ever find out what is going on or if you can narrow it down with a demo app. I'm not sure what to do with this crash otherwise.

One thing I'd look for is perhaps you are calling/creating UI methods/classes in a non-UI thread. Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants