Repository navigation
fix(runtime): close replaced devices on move assignment - #236
Open
salty-sugar-art wants to merge 1 commit into
Open
salty-sugar-art wants to merge 1 commit into
salty-sugar-art wants to merge 1 commit into
Conversation
|
This branch has not been deployed
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.



Description
Move-assigning a
Runtimediscards its old runtime state. Device handles that are still held by the caller keep the old devices alive, and the replacement runtime can no longer close those devices. Move the incoming state through a temporary and swap it into the destination so the temporary closes the replaced devices through the existing destructor. Devices from the incoming runtime stay usable.Reproduction
/dev/uinput. For the Linux check, give the profiles distinct names and record each gamepad's paths fromdevice_nodes().*runtime = std::move(*replacement)while both gamepad handles are alive.is_open()and submit a report through the old handle. On Linux, also check whether the old paths still exist. On45443d6, the old handle remains open and accepts reports, and the old Linux input device remains registered. With the fix, the old handle reportsdevice_closed, its device node disappears, and the incoming gamepad still accepts input.Screenshot
Issues Fixed or Closed
Roadmap Issues
Testing
RuntimeTest.MoveAssignmentClosesReplacedDevicesandRuntimeTest.SelfMoveAssignmentKeepsDevicesOpen. Ran--gtest_filter='RuntimeTest.*MoveAssignment*'against the baseline library with the new tests. The cleanup regression failed as expected. Both tests passed with the fix.gamepad_adapterwith GCC 13.3 on Ubuntu 24.04 under WSL2. Ran a focused GoogleTest binary linked against that library. All 111 selected tests passed, including the runtime and gamepad lifecycle tests.uinputcheck with two Xbox 360 devices. Before the fix, both nodes remained after move assignment. With the fix, the old node disappeared and the incoming node stayed online and accepted input.gamepad_adapter x360also passed.clang-format --dry-run --Werrorandgit diff --check./dev/uhid, which was unavailable in this WSL instance.Type of Change
Checklist
AI Usage
See our AI usage policy.
OpenAI Codex (GPT-6, reasoning effort unavailable in this session) investigated the defect, implemented and tested the fix, and prepared this PR description.