+
Skip to content

Conversation

tinyjin
Copy link
Member

@tinyjin tinyjin commented Sep 2, 2025

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

@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 07:22
@tinyjin tinyjin requested a review from hermet as a code owner September 2, 2025 07:22
@tinyjin tinyjin self-assigned this Sep 2, 2025
@github-actions github-actions bot added the renderer Core rendering label Sep 2, 2025
Copy link

@Copilot Copilot AI left a 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 and Synced statuses to only allowing Updating and Drawing 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.

Copy link
Member

@hermet hermet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. please check copilot comment, || is correct.
  2. 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.

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.
@tinyjin tinyjin changed the title renderer: prevent deadlock by deferring remove() in initialization phase renderer: revise canvas context handling in target method Sep 2, 2025
@tinyjin tinyjin requested a review from hermet September 2, 2025 09:20
Copy link
Member

@hermet hermet left a 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!

@hermet hermet merged commit 8f86d20 into main Sep 2, 2025
15 checks passed
@hermet hermet deleted the jinny/fix-renderer branch September 2, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

renderer Core rendering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载