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

Prevent panic when submitting a destroyed buffer #4698

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

nical
Copy link
Contributor

@nical nical commented Nov 16, 2023

Checklist

  • Run cargo clippy.

Connections

Another adjustment after #4657.

Description

The code in command buffer submission uses the "infallible" storage getter that panics if a texture or buffer has been destroyed, this PR adds the explicit check. Before #4657, the case of destroyed buffer was somewhat handled by checking whether the raw buffer was None. it would not catch that a buffer had been scheduled for destruction but not actually destroyed yet. With this PR we can safely unwrap the option because get only returns the buffer if it is in a valid state.

Testing

Covered by the CTS

@nical nical requested a review from a team as a code owner November 16, 2023 10:51
@nical nical force-pushed the submit-destroyed-buffer branch from a6dd5db to 32a701f Compare November 16, 2023 10:51
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Looks fine for now, left a suggestion.

wgpu-core/src/device/queue.rs Show resolved Hide resolved
@nical nical force-pushed the submit-destroyed-buffer branch from 32a701f to 02835f1 Compare November 16, 2023 13:07
@teoxoy teoxoy merged commit 1d7c7c8 into gfx-rs:trunk Nov 16, 2023
27 checks passed
@nical nical deleted the submit-destroyed-buffer branch November 16, 2023 13:28
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