Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

look into other timer for invalidating? #153

Open
Rytisgit opened this issue Dec 31, 2022 · 0 comments
Open

look into other timer for invalidating? #153

Rytisgit opened this issue Dec 31, 2022 · 0 comments

Comments

@Rytisgit
Copy link
Owner

unoplatform/uno#1451
Yes I do have update. It seems that the issue is related to the way the GC is handling some of the Skia unmanaged references during the finalizers execution.

In your sample, you can do two things:

Either extract the SKPaint instances out of the OnPaintSurface, or make sure to dispose all the instances at the end of the scope. (the using var feature of C# 8.0 may be handy there). In your app, you should do the same for all disposable SkiaSharp types.
Avoid using Threading.Timer, and use DispatcherTimer. The former is using javascript directly and is somehow slower than the latter:
_t = new DispatcherTimer();
_t.Interval = TimeSpan.FromMilliseconds(200);
_t.Tick += delegate
{
Invalidate();
};
_t.Start();
There is definitely an underlying issue with the way the GC works, I'll a smaller repro and create a new one to track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant