CNA-BUG-238: Win32Window's CnaPlatformWindow.Owned property is written and removed but never read, and its comment misdescribes AdoptWindowHandle
Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.
The kOwnedWindowProperty is set on every CNA-created HWND and removed on destroy but read nowhere; its comment says it lets AdoptWindowHandle refuse an owned window, whereas adoption returns a borrowed wrapper sharing the owner's id.
- Identifier
CNA-BUG-238- Category
- Bug
- Subsystem
- Documentation & release tooling
- Status
- Open
- Verified against
- CNA
009d40f5(009d40f5dd085c4e674d3479675fac84b12b3e0a) - Severity
- Low (a triage suggestion, not a project priority)
- Evidence basis
- Source-verified: read at TARGET, not executed
- Tests touching this area
- Yes: see Current tests
- Affected contract
- The CnaPlatformWindow.Owned window property and its documentation in CNA::Platform::Win32::Win32Window
Expected behaviour
A window property CNA sets on every owned HWND, with a comment explaining what reads it, should either be read for that purpose or not be described as one.
Actual behaviour at TARGET
Win32Window calls SetPropW(hwnd_, kOwnedWindowProperty, ...) after CreateWindowExW and RemovePropW on teardown, and its comment says the property is “so AdoptWindowHandle can refuse to adopt a window the platform already owns.” No GetPropW reads it anywhere. Win32Platform::AdoptWindowHandle does not consult the property: for a known HWND it finds the id in windows_ and returns a borrowed wrapper that shares the owner's id, and Win32WindowTest.LegacyTokenRoundTripsThroughAdoption asserts exactly that (adopted->GetId() == window->GetId()). The property is dead, and its comment describes behaviour the code does not implement.
Source locations
modules/platform/src/Win32/Win32Window.cpp— kOwnedWindowProperty SetPropW/RemovePropW and the comment; no GetPropWmodules/platform/src/Win32/Win32Platform.cpp— AdoptWindowHandle returns a borrowed wrapper for a known HWND, not a refusalmodules/platform/tests/CNA/Platform/Win32WindowTests.cpp— LegacyTokenRoundTripsThroughAdoption asserts the shared id
Evidence
Checked by reading the property's SetPropW/RemovePropW sites, AdoptWindowHandle and the adoption test, and searching the Win32 sources for GetPropW (none) at 009d40f5. Not executed. The Development Win32 page records the same maintainer note.
Focused reproduction
No focused reproduction is known. Nothing has been invented here; the evidence above is what exists.
Current tests
LegacyTokenRoundTripsThroughAdoption and AdoptedWindowDoesNotDestroy pin the borrow-and-share-id behaviour; no test reads the owned property.
Regression test
Either remove the property and correct the comment, or make AdoptWindowHandle read it and behave as the comment says; a test should then assert whichever contract is chosen.
Blast radius
Maintainers of Win32 window adoption who trust the comment; no runtime effect, since nothing reads the property.
Workaround
No workaround is known.
Related pages
The same subject is explained at several altitudes. These are the neighbouring pages at each one.
- User guide
- Native platforms: Win32
- Internals
- Win32 platform internals: windows
- Maintainer workflow
- Modify a platform backend
- Known issues
- Bug index