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

Fix GC borrow hazard in XRInputSourceArray #33857

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

chickenleaf
Copy link
Contributor

File: components/script/dom/xrinputsourcearray.rs

PR Description

Issue: Fix GC borrow hazard in XRInputSourceArray::add_input_sources, remove_input_source, and add_remove_input_source.

Changes:

  1. Removed long-lived mutable borrows of input_sources.
  2. Replaced with short-lived mutable borrows as needed.
  3. Updated debug_assert! to avoid referencing removed variable.

Impact:
Resolves potential panic during garbage collection by ensuring short-lived borrows, reducing GC-related risks.


  • There are tests for these changes OR
  • These changes do not require tests because they only refactor code to fix borrow hazards without altering functionality.

@chickenleaf chickenleaf requested a review from gterzian as a code owner October 16, 2024 06:05
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

Thanks!

@jdm jdm added this pull request to the merge queue Oct 16, 2024
Merged via the queue into servo:main with commit 2e0fbfc Oct 16, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants