m66n / ipaddresscontrollib

Automatically exported from code.google.com/p/ipaddresscontrollib
Other
62 stars 26 forks source link

NullReferenceException when disposing and control has focus #27

Open cvogt61457 opened 7 months ago

cvogt61457 commented 7 months ago

There is a NullReferenceException when disposing and control has focus.

When disposing, the FieldControls and LabelControls are disposed. The base.Dispose(disposing) is then called.

A NullReferenceException is thrown from inside the base.Dispose().
_Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at IPAddressControlLib.IPAddressControl.get_Focused() at IPAddressControlLib.IPAddressControl.OnLostFocus(EventArgs e) at System.Windows.Forms.Control.WmKillFocus(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)_

It appears that get_Focused() accesses the null _fieldControls causing the exception.