Fall back to kernel copies when handler registration fails #988

Open
ryotdev wants to merge 1 commit from upstream-pr/990 into main
ryotdev commented 2026-11-25 15:15:13 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by ryotdev on 2026-11-25T15:15:13Z.


With VICTORY_COPY_PLAIN=1, the fast path relies on a Windows exception handler to recover when a source page disappears. Windows can return a null handle from registration. The previous code discarded that result and could start the copy anyway. Windows API return value

This change remembers whether registration succeeded. If it failed, the renderer logs the failure once and uses the existing kernel copy path. The regression injects a null registration result, checks that the destination stays untouched, and verifies that registration is attempted only once.

Verification

  • Built the Windows x64 diagnostics test target for victory-gpu and ran plaincopy::tests --test-threads=1 on Windows. All five tests passed.
  • As a negative control, ignoring registration failure in the guarded copy made the new test fail.
  • git diff --check passed.

AI-assisted. #946 touches the same handler for a separate change and may need a rebase.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6607699732 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/990). Originally posted by [ryotdev](https://github.com/ryotdev) on 2026-11-25T15:15:13Z. --- With `VICTORY_COPY_PLAIN=1`, the fast path relies on a Windows exception handler to recover when a source page disappears. Windows can return a null handle from registration. The previous code discarded that result and could start the copy anyway. [Windows API return value](https://learn.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-addvectoredexceptionhandler#return-value) This change remembers whether registration succeeded. If it failed, the renderer logs the failure once and uses the existing kernel copy path. The regression injects a null registration result, checks that the destination stays untouched, and verifies that registration is attempted only once. **Verification** - Built the Windows x64 diagnostics test target for `victory-gpu` and ran `plaincopy::tests --test-threads=1` on Windows. All five tests passed. - As a negative control, ignoring registration failure in the guarded copy made the new test fail. - `git diff --check` passed. AI-assisted. #946 touches the same handler for a separate change and may need a rebase.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/990:upstream-pr/990'
git switch 'upstream-pr/990'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/990'
git switch 'upstream-pr/990'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/990'
git switch 'upstream-pr/990'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/990'
git switch 'main'
git merge --squash 'upstream-pr/990'
git switch 'main'
git merge --ff-only 'upstream-pr/990'
git switch 'main'
git merge 'upstream-pr/990'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!988
No description provided.