-
Notifications
You must be signed in to change notification settings - Fork 703
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
Null reference in v2 in FindDeepestView #3667
Comments
The only way this can happen is if |
I take that back. That's old/fake news. It should not be possible for those to be null if the View constructor was called: public View ()
{
SetupAdornments ();
SetupKeyboard ();
//SetupMouse ();
SetupText ();
}
private void SetupAdornments ()
{
//// TODO: Move this to Adornment as a static factory method
if (this is not Adornment)
{
Margin = new (this);
Border = new (this);
Padding = new (this);
}
} ... Unless the View was disposed... private void DisposeAdornments ()
{
Margin?.Dispose ();
Margin = null;
Border?.Dispose ();
Border = null;
Padding?.Dispose ();
Padding = null;
} |
For sure is that the case. View was already disposed. |
Indeed the view being disposed is the bug. Bug originates in TopLevel which seems to have code that dispose the view on
[Fact]
public void no_dispose_menu ()
{
var mb = new MenuBar ();
var tl = new Toplevel ();
Assert.False (mb.WasDisposed);
tl.Add (mb);
Assert.False (mb.WasDisposed);
tl.Remove (mb);
// Currently fails here
Assert.False (mb.WasDisposed);
} |
…r-remove-fix Fixes #3667. Null reference in v2 in FindDeepestView.
…roblems than it solves now See gui-cs/Terminal.Gui#3667
Describe the bug

FindDeepestView
can crash when a view has null Margin e.g. MenuBar (in below codestart
is aMenuBar
The text was updated successfully, but these errors were encountered: