Skip to content

fix(native): add missing thread names on Windows#1601

Merged
jpnurmi merged 4 commits into
masterfrom
jpnurmi/fix/native-win32-thread-names
Mar 27, 2026
Merged

fix(native): add missing thread names on Windows#1601
jpnurmi merged 4 commits into
masterfrom
jpnurmi/fix/native-win32-thread-names

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator
image

jpnurmi and others added 2 commits March 27, 2026 13:58
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Missing NULL check before CloseHandle on crashed thread
    • Added a NULL guard around the crashed thread OpenThread result so CloseHandle is only called with a valid handle.

Create PR

Or push these changes by commenting:

@cursor push 80a1a78792
Preview (80a1a78792)
diff --git a/src/backends/native/sentry_crash_daemon.c b/src/backends/native/sentry_crash_daemon.c
--- a/src/backends/native/sentry_crash_daemon.c
+++ b/src/backends/native/sentry_crash_daemon.c
@@ -1642,8 +1642,10 @@
     // Retrieve the name for the crashed thread (index 0)
     HANDLE hCrashedThread
         = OpenThread(THREAD_QUERY_LIMITED_INFORMATION, FALSE, crashed_tid);
-    get_thread_name(hCrashedThread, &ctx->platform.threads[0]);
-    CloseHandle(hCrashedThread);
+    if (hCrashedThread != NULL) {
+        get_thread_name(hCrashedThread, &ctx->platform.threads[0]);
+        CloseHandle(hCrashedThread);
+    }
 
     SENTRY_DEBUGF(
         "enumerate_threads: start, crashed_tid=%lu, threads[0].id=%lu",

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment thread src/backends/native/sentry_crash_daemon.c Outdated
doesn't throw any exception locally even in debugger, but the docs
explicitly state that the handle should be valid.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jpnurmi jpnurmi requested review from mujacica and tustanivsky March 27, 2026 13:23
@jpnurmi jpnurmi merged commit 524926d into master Mar 27, 2026
52 checks passed
@jpnurmi jpnurmi deleted the jpnurmi/fix/native-win32-thread-names branch March 27, 2026 16:36
BernhardMarconato pushed a commit to elgatosf/sentry-native that referenced this pull request Apr 21, 2026
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants