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

[Windows .NET MAUI 9.0] SKGLView is missing DispatcherQueue from InvalidateSurface #2945

Open
1 task done
janne-hmp opened this issue Jul 17, 2024 · 1 comment
Open
1 task done
Labels

Comments

@janne-hmp
Copy link

Description

We got an immediate re-entrancy crash on Windows (and on no other platforms) when using SKGLView in .NET MAUI 9.0 Preview 6 with SkiaSharp 3.0 Preview 3.1. By adding:

#if WINDOWS
                if(GHApp.WindowsXamlWindow != null)
                {
                    GHApp.WindowsXamlWindow.DispatcherQueue?.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.High, () => 
                    {
#endif
                        internalGLView.InvalidateSurface();
#if WINDOWS
                    });
                }
#endif

the re-entrancy crash disappeared. It looks like that DispatcherQueue code should be added to Windows SKGLView directly. I was wondering on whether priority should be High or Normal, but High seemed to work fine, and sounded more appropriate for a game loop. (Note: RenderLoop did not really work at least in our case; it refreshed the screen at high frequency but the animations on the screen / actual drawing were updated very infrequently.)

Code

https://github.com/hyvanmielenpelit/GnollHack

Expected Behavior

SKGLView on Windows does not crash in re-entrancy upon consecutively calling InvalidateSurface.

Actual Behavior

SKGLView on Windows crashes in re-entrancy upon consecutively calling InvalidateSurface.

Version of SkiaSharp

3.x (Alpha)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Windows 11.

Devices

MSI Laptop.

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@janne-hmp janne-hmp changed the title [Windows .NET MAUI 9.0] SKGLView is missing DispatcherQueue from InvalidateSurfance [Windows .NET MAUI 9.0] SKGLView is missing DispatcherQueue from InvalidateSurface Jul 17, 2024
@janne-hmp
Copy link
Author

janne-hmp commented Jan 30, 2025

@mattleibow This seems to be fixed now in SkiaSharp 3.116.1 and .NET MAUI 9.0 on Windows. In fact, adding the dispatcher queue seems to sometimes freeze the screen update. Did something change here over the past few months (after 29 Sep)? (There is no reentrancy crash anymore.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Ready For Work
Development

No branches or pull requests

1 participant