From 62f66e6ac99ea3cce2950f22c3557ee1f51b2888 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 8 Apr 2024 18:45:49 +0200 Subject: [PATCH] Fix a crash when closing the app when running (#269) --- .../Controls/SKAnimatedSurfaceView.shared.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/SkiaSharp.Extended.UI/Controls/SKAnimatedSurfaceView.shared.cs b/source/SkiaSharp.Extended.UI/Controls/SKAnimatedSurfaceView.shared.cs index 50cd1ed6..48c2f877 100644 --- a/source/SkiaSharp.Extended.UI/Controls/SKAnimatedSurfaceView.shared.cs +++ b/source/SkiaSharp.Extended.UI/Controls/SKAnimatedSurfaceView.shared.cs @@ -82,6 +82,14 @@ private void UpdateIsAnimationEnabled() if (!weakThis.TryGetTarget(out var strongThis)) return false; +#if !XAMARIN_FORMS + if (strongThis.Window is null) + return false; +#endif + + if (!strongThis.IsLoadedEx()) + return false; + strongThis.Invalidate(); return strongThis.IsAnimationEnabled;