зеркало из https://github.com/DeGsoft/maui-linux.git
[C] Dispose the Disposable (#7020)
Dispose the disposable readers while parsing StyleSheets - fixes #6986
This commit is contained in:
Родитель
615855fe87
Коммит
ec218f165a
|
@ -36,7 +36,9 @@ namespace Xamarin.Forms.StyleSheets
|
||||||
{
|
{
|
||||||
var styleSheet = new StyleSheet();
|
var styleSheet = new StyleSheet();
|
||||||
var resString = DependencyService.Get<IResourcesLoader>().GetResource(resourcePath, assembly, styleSheet, lineInfo);
|
var resString = DependencyService.Get<IResourcesLoader>().GetResource(resourcePath, assembly, styleSheet, lineInfo);
|
||||||
Parse(styleSheet, new CssReader(new StringReader(resString)));
|
using (var textReader = new StringReader(resString))
|
||||||
|
using (var cssReader = new CssReader(textReader))
|
||||||
|
Parse(styleSheet, cssReader);
|
||||||
return styleSheet;
|
return styleSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +58,8 @@ namespace Xamarin.Forms.StyleSheets
|
||||||
throw new ArgumentNullException(nameof(reader));
|
throw new ArgumentNullException(nameof(reader));
|
||||||
|
|
||||||
var sheet = new StyleSheet();
|
var sheet = new StyleSheet();
|
||||||
Parse(sheet, new CssReader(reader));
|
using (var cssReader = new CssReader(reader))
|
||||||
|
Parse(sheet, cssReader);
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,13 +97,11 @@ namespace Xamarin.Forms.StyleSheets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Type IStyle.TargetType
|
Type IStyle.TargetType => typeof(VisualElement);
|
||||||
=> typeof(VisualElement);
|
|
||||||
|
|
||||||
void IStyle.Apply(BindableObject bindable)
|
void IStyle.Apply(BindableObject bindable)
|
||||||
{
|
{
|
||||||
var styleable = bindable as Element;
|
if (!(bindable is Element styleable))
|
||||||
if (styleable == null)
|
|
||||||
return;
|
return;
|
||||||
Apply(styleable);
|
Apply(styleable);
|
||||||
}
|
}
|
||||||
|
@ -114,8 +115,7 @@ namespace Xamarin.Forms.StyleSheets
|
||||||
|
|
||||||
void ApplyCore(Element styleable)
|
void ApplyCore(Element styleable)
|
||||||
{
|
{
|
||||||
var visualStylable = styleable as VisualElement;
|
if (!(styleable is VisualElement visualStylable))
|
||||||
if (visualStylable == null)
|
|
||||||
return;
|
return;
|
||||||
foreach (var kvp in Styles) {
|
foreach (var kvp in Styles) {
|
||||||
var selector = kvp.Key;
|
var selector = kvp.Key;
|
||||||
|
@ -126,9 +126,6 @@ namespace Xamarin.Forms.StyleSheets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IStyle.UnApply(BindableObject bindable)
|
void IStyle.UnApply(BindableObject bindable) => throw new NotImplementedException();
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче