fix(desktop): don't close picker webview before window screenshot - #2071
Merged
Conversation
Keep the window screenshot picker alive until takeScreenshot is dispatched on Windows. Close target-selection overlays on every capture outcome without allowing cleanup failures to mask the original error.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
Closes #2046.
Problem
On Windows, taking a screenshot of a specific window silently never happened: no file written, no error, no log. The window variant's
onRecordingStartcalledcloseTargetSelectOverlays()whileoptions.mode === "screenshot". On Windows that command closes the overlay webviews (to release the DirectComposition surface) rather than hiding them, andtakeScreenshotis invoked from that same webview immediately afterwards, so the webview was destroyed before the IPC call was dispatched.Fix
finally)..catch(console.error)).Verification
win.hide()plus the backendhide_overlay()+ 150 ms settle insidetake_screenshot, identical to the display flow, so this change does not extend the time a hidden overlay could be captured.closeTargetSelectOverlays/takeScreenshotcall sites audited: recording modes and the area-screenshot path are untouched.biome checkpasses.Known pre-existing gaps, out of scope: on failure the toast renders in an already-hidden webview, and the area-screenshot path only closes overlays on success. Worth a follow-up issue.
Greptile Summary
This PR corrects the desktop window-screenshot lifecycle by keeping the picker webview alive until screenshot IPC is dispatched.
finallyso it runs after successful and failed captures.Confidence Score: 5/5
The PR appears safe to merge because screenshot dispatch now completes before overlay destruction while cleanup still runs on both success and failure.
The selected target is preserved before dismissal, overlays are hidden before capture by both frontend and backend paths, and post-capture cleanup errors are contained without masking screenshot failures.
Important Files Changed
Reviews (1): Last reviewed commit: "fix(desktop): don't close picker webview..." | Re-trigger Greptile
Context used: