зеркало из https://github.com/mono/SkiaSharp.git
fix: XamlRoot may be null when the SKXamlCanvas is unloaded (#2854)
* fix: XamlRoot may be null when the SKXamlCanvas is unloaded * chore: Adjust more xamlroot uses --------- Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
This commit is contained in:
Родитель
258a6f62bd
Коммит
8e7a51dc04
|
@ -101,7 +101,7 @@ namespace SkiaSharp.Views.UWP
|
|||
private void OnXamlRootChanged(XamlRoot xamlRoot = null, XamlRootChangedEventArgs e = null)
|
||||
{
|
||||
var root = xamlRoot ?? XamlRoot;
|
||||
Dpi = root.RasterizationScale;
|
||||
Dpi = root?.RasterizationScale ?? 1.0;
|
||||
Invalidate();
|
||||
}
|
||||
#else
|
||||
|
@ -141,7 +141,10 @@ namespace SkiaSharp.Views.UWP
|
|||
return;
|
||||
|
||||
#if WINDOWS
|
||||
XamlRoot.Changed -= OnXamlRootChanged;
|
||||
if(XamlRoot != null)
|
||||
{
|
||||
XamlRoot.Changed -= OnXamlRootChanged;
|
||||
}
|
||||
#else
|
||||
var display = DisplayInformation.GetForCurrentView();
|
||||
display.DpiChanged -= OnDpiChanged;
|
||||
|
|
Загрузка…
Ссылка в новой задаче