-
-
Notifications
You must be signed in to change notification settings - Fork 157
renderer: revise canvas context handling in target method #3773
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a deadlock issue in the ThorVG renderer by modifying the status checking logic in canvas target methods. The change prevents the WG engine's target() method from returning early during the initialization phase when the status is Painting
, which previously caused context initialization to be skipped and led to deadlocks in subsequent render operations.
- Updated status validation logic in
target()
methods for SwCanvas, GlCanvas, and WgCanvas - Changed from allowing
Damaged
andSynced
statuses to only allowingUpdating
andDrawing
statuses - Prevents early return during initialization phase that was causing unset context issues
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please check copilot comment,
||
is correct. - Please update the title — there is no deadlock issue in ThorVG itself. The deadlock is entirely due to the WASM binding, caused by a naughty implementation of context handling. You've now revised the concept of the canvas context, so the title should be updated accordingly.
b3ceae5
to
088fe9f
Compare
This update refines the management of the canvas context during initialization and operation. By improving context handling, it resolves a potential issue where the target method might not function correctly in certain cases.
088fe9f
to
1373e18
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tinyjin thanks for your effort!
This update refines the management of the canvas context during initialization and operation. By improving context handling, it resolves a potential issue where the target method might not function correctly in certain cases.
related: #3763