Mark RawHandleWrapper::set_display_handle as unsafe - #25267
Merged
Conversation
Contributor
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
yilin0518
force-pushed
the
fix_set_display
branch
from
August 2, 2026 13:51
1890d4c to
0f1b723
Compare
SludgePhD
approved these changes
Aug 2, 2026
mockersf
approved these changes
Aug 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
RawHandleWrapper::set_display_handle.set_display_handleis currently a safe function even though its documentation requires the providedRawDisplayHandleto be valid.RawDisplayHandlecontaining a non-null but invalid platform pointer and pass it to this method. Bevy may later use that value withDisplayHandle::borrow_raworwgpu::Instance::create_surface_unsafe, both of which rely on the raw display handle being valid.set_display_handleinconsistent withset_window_handle, which already enforces the equivalent requirement through an unsafe function.Solution
I take the minimal fix:
RawHandleWrapper::set_display_handleasunsafe.Testing
I didn't check any test about this PR because I can't find any place that use
set_display_handle. So I think this change no need to do any test.