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

[BUG] Using SKPaint.Clone() leads to Access Violation in DisposeNative when upgrading to SkiaSharp 3.0 #2755

Open
1 task done
Rippletank opened this issue Feb 14, 2024 · 1 comment
Labels

Comments

@Rippletank
Copy link

Description

I'm in the processes of upgrading an existing app to SkiaSharp version 3 to try out the exciting new GPU acceleration integration with Maui on windows. After the upgrade and before enabling acceleration, I found I was getting Access Violations in DisposeNative of SKPaint. The call Stack only starts at ~SKNativeObject, so I guessed it was something to do with the GC. I was eventually was able to stop the error appearing by replace any calls to Clone() on SKPaint objects, most of which were due to earlier bad design choices on my part.

I haven't done a repo on this as its part of a large project, but wanted to flag it.

Am I right in thinking that the SKPaint class has developed much deeper links with the native code than in version 3.0? Is there any discussions/bug report/notes that could help understand the changes to this class and what that means? For example, is a performance benefit to keep an SKPaint object long term to avoid creating a fresh one for each draw call? Similarly with the SKFont, the separation from the SKPaint object makes a lot of sense, I removed all of the obsolete calls, but is it ok to keep the SKFont objects around long term?

Code

paint = oldPaint.Clone();

Expected Behavior

No response

Actual Behavior

No response

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

2.88.2 (Previous)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

Windows

Platform / Operating System Version

Maui Windows11

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

Stack trace: 

	[Managed to Native Transition]	
>	SkiaSharp.dll!SkiaSharp.SKPaint.DisposeNative() Line 428	C#
 	SkiaSharp.dll!SkiaSharp.SKNativeObject.Dispose(bool disposing) Line 61	C#
 	SkiaSharp.dll!SkiaSharp.SKObject.Dispose(bool disposing) Line 90	C#
 	SkiaSharp.dll!SkiaSharp.SKPaint.Dispose(bool disposing) Line 424	C#
 	SkiaSharp.dll!SkiaSharp.SKNativeObject.~SKNativeObject() Line 34	C#

Code of Conduct

  • I agree to follow this project's Code of Conduct
@FoggyFinder
Copy link
Contributor

@Rippletank likely your issue was fixed in #2904

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

No branches or pull requests

2 participants