Add missing lock in IStyle.Apply

This commit is contained in:
E.Z. Hart 2021-03-11 10:54:49 -07:00
Родитель dfd34d1fb6
Коммит 2a383f288e
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -85,7 +85,11 @@ namespace Microsoft.Maui.Controls
void IStyle.Apply(BindableObject bindable) void IStyle.Apply(BindableObject bindable)
{ {
_targets.Add(new WeakReference<BindableObject>(bindable)); lock (_targets)
{
_targets.Add(new WeakReference<BindableObject>(bindable));
}
if (BaseResourceKey != null) if (BaseResourceKey != null)
bindable.SetDynamicResource(_basedOnResourceProperty, BaseResourceKey); bindable.SetDynamicResource(_basedOnResourceProperty, BaseResourceKey);
ApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable)); ApplyCore(bindable, BasedOn ?? GetBasedOnResource(bindable));