fix(native): add missing thread names on Windows#1601
Merged
Conversation
Collaborator
jpnurmi
commented
Mar 27, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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
OpenThreadresult soCloseHandleis only called with a valid handle.
- Added a NULL guard around the crashed thread
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.
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>
tustanivsky
approved these changes
Mar 27, 2026
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.

