Repository navigation
windows: copy handles through voidptr() where a mutable copy of an immutable handle is taken - #105
Merged
Merged
Conversation
…mutable handle is taken
V master's checker refuses `mut h := outer` when `outer` is an immutable
pointer ("cannot have a mutable reference to an immutable object"), so a
`-W` build of any example stopped on five such lines in ui_windows.v
(set_text, windows_create_element, windows_apply_element,
ui2_windows_context_menu, ui2_windows_cursor). Each is a handle copied to
walk or re-point; the copy is spelled `voidptr(x)`, which says so.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Author
|
The red checks here are not this branch's. The |
Member
|
lgtm |
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.
The follow-up offered on #104: the five mutability notices in
windows/ui_windows.v.V master's checker refuses
mut h := outerwhenouteris an immutable pointer (outer is immutable, cannot have a mutable reference to an immutable object), so a-Wbuild of any example on Windows stopped on five lines:set_text,windows_create_element,windows_apply_element,ui2_windows_context_menuandui2_windows_cursor. Each is a window handle copied so the copy can be re-pointed (walked up to a parent, swapped for a label's inner control). The copy is now spelledvoidptr(x), which says that a new handle value is taken, not a reference to the variable. No behaviour change.Verified on Windows 11 with V master (77e34807 + a driver patch, tcc and llvm-mingw clang):
v -N -W -cc tcc examples/editorbefore: the five errors above; after: none inwindows/ui_windows.v.v -cc tcc examples/editor(native) andv -cc clang -d ui2_custom_rendering examples/gpui_editorbuild.v -enable-globals -cc tcc test windows/ui_windows_test.vpasses. Under-N -Wit stops on six notices in the test file itself (lines 163, 215, 367, 368, 381, 382), the same before and after; none inui_windows.v.v fmt -verifyclean.Seen but left, since they are not Windows code: under V master
-Nthe examples still stop on four cross-platform notices (gridshadows a function inui/component_color.vtwice andui/component_plot_axis.v, an uninitialisedfnfield inui/frame_scheduler.v;scaleshadows a function in three files under the custom renderer). They are notices on 0.5.2, which the CI pins.🤖 Generated with Claude Code