Browse Source

Merge pull request #6839 from workgroupengineering/fixes/Issue_6838

fixes(DevTools): Double subscribe/unsubscribe INotifyPropertyChanged
release/0.10.11-rc.1
Max Katz 5 years ago
committed by Dan Walmsley
parent
commit
25de5547b2
  1. 24
      src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs

24
src/Avalonia.Diagnostics/Diagnostics/ViewModels/ControlDetailsViewModel.cs

@ -435,16 +435,16 @@ namespace Avalonia.Diagnostics.ViewModels
protected void NavigateToProperty(object o, string entityName)
{
if (SelectedEntity is INotifyPropertyChanged inpc1)
var oldSelectedEntity = SelectedEntity;
if (oldSelectedEntity is IAvaloniaObject ao1)
{
inpc1.PropertyChanged -= ControlPropertyChanged;
ao1.PropertyChanged -= ControlPropertyChanged;
}
if (SelectedEntity is AvaloniaObject ao1)
else if (oldSelectedEntity is INotifyPropertyChanged inpc1)
{
ao1.PropertyChanged -= ControlPropertyChanged;
inpc1.PropertyChanged -= ControlPropertyChanged;
}
SelectedEntity = o;
SelectedEntityName = entityName;
SelectedEntityType = o.ToString();
@ -460,17 +460,15 @@ namespace Avalonia.Diagnostics.ViewModels
view.GroupDescriptions.Add(new DataGridPathGroupDescription(nameof(AvaloniaPropertyViewModel.Group)));
view.Filter = FilterProperty;
PropertiesView = view;
if (o is INotifyPropertyChanged inpc2)
{
inpc2.PropertyChanged += ControlPropertyChanged;
}
if (o is AvaloniaObject ao2)
if (o is IAvaloniaObject ao2)
{
ao2.PropertyChanged += ControlPropertyChanged;
}
else if (o is INotifyPropertyChanged inpc2)
{
inpc2.PropertyChanged += ControlPropertyChanged;
}
}
}
}

Loading…
Cancel
Save