Skip to content

feat(screenshot): support out-of-proc capture#1541

Merged
mujacica merged 2 commits intomasterfrom
feat/screenshot-pid
Feb 25, 2026
Merged

feat(screenshot): support out-of-proc capture#1541
mujacica merged 2 commits intomasterfrom
feat/screenshot-pid

Conversation

@mujacica
Copy link
Contributor

@mujacica mujacica commented Feb 24, 2026

Add a pid parameter to sentry__screenshot_capture() to allow capturing the windows of a specific process instead of always using the current process. Passing 0 preserves the existing behavior.

This is needed for the upcoming native backend (#1433), where a daemon process captures screenshots on behalf of the crashed application.

Partially cherry-picked from 62f1cdb (#1433)

#skip-changelog (internal)

Add a `pid` parameter to `sentry__screenshot_capture()` to allow
capturing the windows of a specific process instead of always using the
current process. Passing 0 preserves the existing behavior.

This is needed for the upcoming native backend (#1433), where a daemon
process captures screenshots on behalf of the crashed application.

Partially cherry-picked from 62f1cdb
(#1433)
@github-actions
Copy link

github-actions bot commented Feb 24, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against b46ef58

@jpnurmi
Copy link
Collaborator

jpnurmi commented Feb 24, 2026

Tested with a fake out-of-proc setup on Windows

windows
diff --git a/src/backends/sentry_backend_inproc.c b/src/backends/sentry_backend_inproc.c
index 6efd2ad4..6b97fb8d 100644
--- a/src/backends/sentry_backend_inproc.c
+++ b/src/backends/sentry_backend_inproc.c
@@ -1169,7 +1169,7 @@ process_ucontext_deferred(const sentry_ucontext_t *uctx,
                 sentry_attachment_t *screenshot = sentry__attachment_from_path(
                     sentry__screenshot_get_path(options));
                 if (screenshot
-                    && sentry__screenshot_capture(screenshot->path, 0)) {
+                    && sentry__screenshot_capture(screenshot->path, 2988)) {
                     sentry__envelope_add_attachment(envelope, screenshot);
                 }
                 sentry__attachment_free(screenshot);
screenshot

@mujacica mujacica merged commit 8058bb3 into master Feb 25, 2026
81 of 82 checks passed
@mujacica mujacica deleted the feat/screenshot-pid branch February 25, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants