Skip to content

Commit

Permalink
fix(wasm): lottie animation event leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoy312 committed Jun 13, 2024
1 parent 3d6a698 commit c10c988
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/AddIns/Uno.UI.Lottie/LottieVisualSourceBase.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ partial class LottieVisualSourceBase

private readonly SerialDisposable _animationDataSubscription = new SerialDisposable();

~LottieVisualSourceBase()
{
if (_initializedPlayer is { })
{
NativeMethods.Kill(_initializedPlayer.HtmlId);
}
}

async Task InnerUpdate(CancellationToken ct)
{
var player = _player;
Expand Down Expand Up @@ -278,6 +286,9 @@ internal static partial class NativeMethods

[JSImport($"{JsType}.stop")]
internal static partial void Stop(nint htmlId);

[JSImport($"{JsType}.kill")]
internal static partial void Kill(nint Handle);
}
}
}

0 comments on commit c10c988

Please sign in to comment.