rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
704 stars 93 forks source link

Bug: Removing TabItems from a TabCollection throws NullReferenceException #313

Closed minimalism closed 3 years ago

minimalism commented 3 years ago

To reproduce:

TabControl tabControl = new();
tabControl.Items.Add(new TabItem("Tab Item"));
tabControl.Items.Clear();
// tabControl.Items.RemoveAt(0); exhibits the same behavior

The setter on ListButton.IsPressed will throw when accessing Parent on line 20, which will be null at this point. I believe the TabItem's Selector will have a Grid InternalChild, whose WidgetsOnCollectionChanged method will unset the Parent property.

rds1983 commented 3 years ago

Should be fixed.